[ty] Add failing mdtest for known Protocol panic
#21594
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a failing mdtest for the panic in astral-sh/ty#1587. The added snippet currently panics with this query stacktrace:
It's not totally clear to me how to fix this or to what extent it might be a bug in our
Protocolinternals rather than a bug in ourTypeVarinternals. (It's sort of interesting that we're trying to evaluate the upper bound of anyTypeVars here!) @carljm suggested that it would be a good idea to add a failing mdtest in the meantime to document the panic, which I agree with.Test Plan
I verified that we panic on this snippet, and that the test fails if I remove the
expect-panicassertion or if I change the asserted error message.I experimented with ways of minimizing the snippet further, but I think any further minimization takes the snippet further away from something a user would actually be likely to write -- so I think is probably counterproductive. The failing test added in this PR isn't unreasonable code at the end of the day; I've seen Python like it in the wild.