Skip to content
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

New semantic analyzer: placeholder nodes from self.x assignment #6338

Open
JukkaL opened this issue Feb 5, 2019 · 0 comments
Open

New semantic analyzer: placeholder nodes from self.x assignment #6338

JukkaL opened this issue Feb 5, 2019 · 0 comments
Labels
bug mypy got something wrong priority-1-normal semantic-analyzer Problems that happen during semantic analysis

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Feb 5, 2019

This test case generates unexpected output:

class C:
    def f(self) -> None:
        self.x: D = D()  # Expression has type "D", variable has type "int"
        self.x: int
        class D: pass

reveal_type(C().x)  # int

The first assignment should take precedence, even though it contains a forward reference. We could probably support this by inserting a placeholder node into the class symbol table.

Follow-up to #6336.

@JukkaL JukkaL added the semantic-analyzer Problems that happen during semantic analysis label Feb 5, 2019
@JukkaL JukkaL added bug mypy got something wrong priority-1-normal labels Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-1-normal semantic-analyzer Problems that happen during semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants