You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Red knot currently panics on some instances of starred expressions (at the outermost layer) of type annotations. An actual example where something like this would occur is in variadic generics (the *Ts):
In this particular case, we currently do not panic since we never run deferred inference on that parameter type. But we would panic if we were to implement function parameter inference.
A case which does lead to a panic is the following (invalid syntax) example:
deff() ->*int: ...
f()
(it's important that this occurs as a return type and that the function is actually called; it doesn't work otherwise)
## Summary
- Store the expression type for annotations that are starred expressions
(see [discussion
here](#14091 (comment)))
- Use `self.store_expression_type(…)` consistently throughout, as it
makes sure that no double-insertion errors occur.
closes#14115
## Test Plan
Added an invalid-syntax example to the corpus which leads to a panic on
`main`. Also added a Markdown test with a valid-syntax example that
would lead to a panic once we implement function parameter inference.
---------
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Red knot currently panics on some instances of starred expressions (at the outermost layer) of type annotations. An actual example where something like this would occur is in variadic generics (the
*Ts
):In this particular case, we currently do not panic since we never run deferred inference on that parameter type. But we would panic if we were to implement function parameter inference.
A case which does lead to a panic is the following (invalid syntax) example:
(it's important that this occurs as a return type and that the function is actually called; it doesn't work otherwise)
A fix for this is already ready at #14106
The text was updated successfully, but these errors were encountered: