Skip to content

Commit

Permalink
fix specificity of sigs that are strict subtypes of vararg sigs
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Oct 14, 2016
1 parent 4ba21aa commit 30bb198
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3132,7 +3132,9 @@ int jl_args_morespecific_fix1(jl_value_t *a, jl_value_t *b, int swap)
if (changed) {
JL_GC_PUSH1(&newtta);
int ret;
if (swap)
if (type_eqv_(b, newtta))
ret = swap;
else if (swap)
ret = jl_args_morespecific_(b, (jl_value_t*)newtta);
else
ret = jl_args_morespecific_((jl_value_t*)newtta, b);
Expand Down
5 changes: 5 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ end

# with bound varargs

_bound_vararg_specificity_1{T,N}(::Type{Array{T,N}}, d::Vararg{Int, N}) = 0
_bound_vararg_specificity_1{T}(::Type{Array{T,1}}, d::Int) = 1
@test _bound_vararg_specificity_1(Array{Int,1}, 1) == 1
@test _bound_vararg_specificity_1(Array{Int,2}, 1, 1) == 0

# issue #11840
typealias TT11840{T} Tuple{T,T}
f11840(::Type) = "Type"
Expand Down

0 comments on commit 30bb198

Please sign in to comment.