-
-
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
WIP: Improve tuple subtyping in invariant position #18451
Conversation
|
||
# issue #18450 | ||
f18450() = ifelse(true, Tuple{Vararg{Int}}, Tuple{Vararg}) | ||
@test f18450() = Tuple{Vararg{Int}} |
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 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.
Oops. I should run tests locally first.
Well, this is awkward. The broken test (core.jl) is hard to fix because it seems to be testing precisely the behaviour that I thought was buggy. Indeed, currently julia> Array{Tuple} <: Array{NTuple} # tested in core.jl
true
julia> Array{NTuple} <: Array{Tuple}
false which is a little weird. Should I just remove the test? |
The problem here, I suppose, is that since As far as I can tell, the only solutions to this are:
|
You've probably followed the breadcrumbs here, but this seems to originate in the fix for #6561. What puzzles me is that the resulting behavior seems to contradict the consensus of the discussion. CC @JeffBezanson. |
I would not bother working on this now, as I'm actively working on #8974 which will replace most of this code and provide a lot of clarity on these kinds of issues. I think with the new algorithm NTuple will be a strict subtype of Tuple, since a tuple can only match |
Should we close this as superseded then? |
Nice, Jeff. Since the new type system won't be backported to 0.5, presumably the issue of "is this worth working on?" depends on whether @TotalVerb needs this for some package to be used with Julia 0.5. I fixed at least one type-system bug precisely for this reason (#18355). But I'd say deleting a test to fix the behavior is breaking and hence can't go into 0.5.x (unless it's a true "emergency," but I don't think that applies). |
I don't need this for v0.5. It would be nice (though not an "emergency") if we could work around the inference bug in the meantime, though. Maybe we could have an inference special case for |
When computing tuple subtype in invariant position, fail early when encountering an unbound typevar. As far as I can tell, this added logic is similar to that for
jl_subtype_le
forDataType
above. (Perhaps this logic should be put into a helper function.)Fix #18450.
Currently not working; it seems to have broken
Array{Tuple} <: Array{NTuple}
.