-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Spurious pattern exhaustivity warning when one type parameter lower-bounds another #15523
Comments
My money is on |
Some rough notes from Dale's and my digging so far:
(As I say, rough notes, but they'll help jog our memory when we come back to this.) We're going to do at least one more round of digging tomorrow, then decide whether to stay on it or bail. |
Related: I realized recently that despite our best effort we could still get recursion in lower bounds: #15280 and I have no idea how to deal with that properly |
Perhaps surprisingly, it matters whether we write We have one provisional fix that involves two changes: the Together that's enough to fix this ticket, but then a bunch of other test cases fail and it isn't clear which failure to dig into to get insight into what might be wrong with the changes. The |
Dale has a new, perhaps more promising implementation of this idea... stay tuned |
Upon further digging, Dale realized that when instantiating an invariant type variable, we aren't free to remove the original and keep only the instantiation, because that same original type variable might need to be constrained a second time if we go into a nested pattern match. That actually happens in That solution path might not be dead; perhaps we can only replace the original type parameter with its instantiation wherever it appears in constraints without But now we're also considering an alternate solution path that would involve fixing Note that |
With the change to |
Also in cycles-in-bounds territory: #14287 |
Note that the original test case is fixable just with the So perhaps there's yet another possible solution path here, namely: Prevent the type avoidance crash (which only arises when we change the rhs of the pattern from |
This example:
Leads to the following spurious warning:
I suspect the issue to be different from #15522, since it is present on both
main
and3.1.2
.The text was updated successfully, but these errors were encountered: