-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[jit] Fix type annotations in select assignments #40528
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
Conversation
Previously, an assignment like `self.foo : List[int] = []` would ignore the type hint. [ghstack-poisoned]
Previously, an assignment like `self.foo : List[int] = []` would ignore the type hint. [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit def2216 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
|
|
||
| def test_type_annotation(self): | ||
| """ | ||
| Test that annotating container attributes with types works correctly |
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.
| Test that annotating container attributes with types works correctly | |
| Test that annotating container attributes with types works correctly. |
|
|
||
| new_list : List[Tuple[float, int, int]] = [(1.0, 1, 1)] | ||
| y.my_list = new_list | ||
| return y |
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.
Do we need an execution test? I think omitting one is fine because the typechecking for y.my_dict = new_dict and y.my_list = new_list is enough to test that the type annotations for self.my_list and self.my_dict are not ignored, but I just wanted to make sure.
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.
Yeah, this is a test on the static parts of the type system, so if the thing compiles correctly then we are good from the perspective of this unit test
Stack from ghstack:
Previously, an assignment like
self.foo : List[int] = []would ignorethe type hint.
Differential Revision: D22222927