-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Rework narrowing logic for equality and identity #20492
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?
Changes from all commits
28fefe6
cce6a71
cdbd737
4dbd107
4a552d5
ca5120d
94c5be7
92051d9
586d2a1
7bc5dac
1ef7ab7
5cc76be
54b4c8e
ce2728e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,12 +194,12 @@ def test_generic_function_type(self) -> None: | |
|
|
||
| def test_type_alias_expand_once(self) -> None: | ||
| A, target = self.fx.def_alias_1(self.fx.a) | ||
| assert get_proper_type(A) == target | ||
| assert get_proper_type(target) == target | ||
| assert get_proper_type(A) == target | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fun, from this assert mypy now knows that |
||
|
|
||
| A, target = self.fx.def_alias_2(self.fx.a) | ||
| assert get_proper_type(A) == target | ||
| assert get_proper_type(target) == target | ||
| assert get_proper_type(A) == target | ||
|
|
||
| def test_recursive_nested_in_non_recursive(self) -> None: | ||
| A, _ = self.fx.def_alias_1(self.fx.a) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4920,6 +4920,7 @@ def test_setattr() -> None: | |
| assert i.one == 1 | ||
| assert i.two == None | ||
| assert i.const == 42 | ||
| i = i | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests have a "check initial values" then call |
||
|
|
||
| i.__setattr__("two", "2") | ||
| assert i.two == "2" | ||
|
|
@@ -4957,6 +4958,7 @@ def test_setattr_inherited() -> None: | |
| assert i.one == 1 | ||
| assert i.two == None | ||
| assert i.const == 42 | ||
| i = i | ||
|
|
||
| i.__setattr__("two", "2") | ||
| assert i.two == "2" | ||
|
|
@@ -4996,6 +4998,7 @@ def test_setattr_overridden() -> None: | |
| assert i.one == 1 | ||
| assert i.two == None | ||
| assert i.const == 42 | ||
| i = i | ||
|
|
||
| i.__setattr__("two", "2") | ||
| assert i.two == "2" | ||
|
|
@@ -5064,6 +5067,7 @@ def test_setattr_nonnative() -> None: | |
| assert i.one == 1 | ||
| assert i.two == None | ||
| assert i.const == 42 | ||
| i = i | ||
|
|
||
| i.__setattr__("two", "2") | ||
| assert i.two == "2" | ||
|
|
@@ -5134,6 +5138,8 @@ def test_no_setattr_nonnative() -> None: | |
| object.__setattr__(i, "three", 102) | ||
| assert i.three == 102 | ||
|
|
||
| i = i | ||
|
|
||
| del i.three | ||
| assert i.three == None | ||
|
|
||
|
|
||
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.
A little unfortunate, because
infer_python_executablehas side effects we infer more code as unreachable