Skip to content

Commit

Permalink
fix #27361, error adding method using e.g. Tuple{3} (#27404)
Browse files Browse the repository at this point in the history
(cherry picked from commit f89921f)
  • Loading branch information
JeffBezanson authored and ararslan committed Jun 17, 2018
1 parent a6f9c6a commit 79b3258
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -2227,8 +2227,10 @@ static int sub_msp(jl_value_t *a, jl_value_t *b, jl_typeenv_t *env)
{
JL_GC_PUSH2(&a, &b);
while (env != NULL) {
a = jl_type_unionall(env->var, a);
b = jl_type_unionall(env->var, b);
if (jl_is_type(a) || jl_is_typevar(a))
a = jl_type_unionall(env->var, a);
if (jl_is_type(b) || jl_is_typevar(b))
b = jl_type_unionall(env->var, b);
env = env->prev;
}
int sub = jl_subtype(a, b);
Expand Down
5 changes: 5 additions & 0 deletions test/specificity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,8 @@ let A = Tuple{Vector, AbstractVector},
@test args_morespecific(B, C)
@test args_morespecific(A, C)
end

# issue #27361
f27361(::M) where M <: Tuple{2} = nothing
f27361(::M) where M <: Tuple{3} = nothing
@test length(methods(f27361)) == 2

0 comments on commit 79b3258

Please sign in to comment.