Skip to content

[release-0.6] fix #22164 and #22002, method sorting problems #22206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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