Skip to content

Commit

Permalink
fix #22164 and #22002, method sorting problems
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 3, 2017
1 parent 68e911b commit 586dff3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -2600,10 +2600,9 @@ static int type_morespecific_(jl_value_t *a, jl_value_t *b, int invariant, jl_ty
if (!jl_is_type(b))
return 0;
if (invariant) {
if (num_occurs((jl_tvar_t*)a, env) < 2)
return 0;
if (eq_msp(((jl_tvar_t*)a)->ub, b, env))
return 1;
return num_occurs((jl_tvar_t*)a, env) >= 2;
return 0;
}
return type_morespecific_((jl_value_t*)((jl_tvar_t*)a)->ub, b, 0, env);
}
Expand Down
9 changes: 9 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ _bound_vararg_specificity_1{T}(::Type{Array{T,1}}, d::Int) = 1
@test args_morespecific(Tuple{Array}, Tuple{AbstractVector})
@test args_morespecific(Tuple{Matrix}, Tuple{AbstractVector})

# issue #22164 and #22002
let A = Tuple{Type{D},D} where D<:Pair,
B = Tuple{Type{Any}, Any},
C = Tuple{Type{Pair}, Pair}
@test args_morespecific(C, A)
@test !args_morespecific(A, B)
@test !args_morespecific(C, B)
end

# issue #12939
module Issue12939
abstract type Abs; end
Expand Down

0 comments on commit 586dff3

Please sign in to comment.