-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix: internal error caused by the generic type alias with an unpacked list #20689
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
Updated type alias test cases to reflect syntax changes.
This comment has been minimized.
This comment has been minimized.
Update error messages for invalid syntax in type alias tests.
This comment has been minimized.
This comment has been minimized.
Add tests for type alias unpacking with lists.
This comment has been minimized.
This comment has been minimized.
Update type alias tests to reflect unpacking errors for list[int].
This comment has been minimized.
This comment has been minimized.
ilevkivskyi
left a comment
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.
Not a full review, just something for you while you are fixing the tests.
| unpacked = get_proper_type(item.type) | ||
| if isinstance(unpacked, Instance): | ||
| assert unpacked.type.fullname == "builtins.tuple" | ||
| if unpacked.type.fullname != "builtins.tuple": |
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.
Please add a comment above this line explaining that expand_type() may be called during semantic analysis, before invalid unpacks are fixed.
This comment has been minimized.
This comment has been minimized.
Add comment to clarify behavior during semantic analysis.
This comment has been minimized.
This comment has been minimized.
Updated test cases for TypeAlias unpacking in Python.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Fixes: #20549