-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add a subtyping fast path for tuple of Unions <: Vararg #33353
Conversation
Test? |
3c2a6bd
to
9dd7b5b
Compare
@@ -1049,6 +1049,10 @@ static int subtype_tuple_tail(struct subtype_tuple_env *env, int8_t R, jl_stenv_ | |||
yi = jl_tparam0(jl_unwrap_unionall(env->vty)); | |||
if (!env->vvx && yi == (jl_value_t*)jl_any_type) | |||
goto done; // if y ends in `Vararg{Any}` skip checking everything | |||
// var T in Vararg{T} is diagonal; an abstract type can't be a subtype of it, | |||
// so avoid exponential blowup when xi is a Union. | |||
if (jl_is_typevar(yi) && jl_is_uniontype(xi) && !jl_has_free_typevars(xi)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There’s also a concrete_min
(which does this for obvious-subtype). But we discovered this was false, I thought, because T wasn’t know to be diagonal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, ok, I can patch that up.
fixes #33337
Replacement for #33345 that improves subtyping instead of reverting.