8000 Fine-grained: Don't infer partial types from multiple targets by JukkaL · Pull Request #4553 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fine-grained: Don't infer partial types from multiple targets #4553

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

Merged
merged 13 commits into from
Feb 20, 2018
Prev Previous commit
Next Next commit
Add test cases
  • Loading branch information
JukkaL committed Feb 8, 2018
commit bf0a9a1dcae73061eb148fed31c30e42af5bcc96
18 changes: 18 additions & 0 deletions test-data/unit/check-inference.test
Original file line number Diff line number Diff line change
Expand Up @@ -2239,3 +2239,21 @@ class A:
self.x = f(p)
f(z for z in p)
[builtins fixtures/list.pyi]

[case testLocalPartialTypesAccessPartialNoneAttribute]
# flags: --local-partial-types
class C:
a = None # E: Need type annotation for 'a'

def f(self, x) -> None:
# TODO: It would be better for the type to be Any here
C.a.y # E: "None" has no attribute "y"

[case testLocalPartialTypesAccessPartialNoneAttribute]
# flags: --local-partial-types
class C:
a = None # E: Need type annotation for 'a'

def f(self, x) -> None:
# TODO: It would be better for the type to be Any here
self.a.y # E: "None" has no attribute "y"
0