Skip to content

mypy doesn't complain about Forward References #1025

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

Closed
rowillia opened this issue Nov 30, 2015 · 2 comments
Closed

mypy doesn't complain about Forward References #1025

rowillia opened this issue Nov 30, 2015 · 2 comments
Labels
bug mypy got something wrong

Comments

@rowillia
Copy link
Contributor

The following code passes through mypy no problem:

class Foo:
    def __init__(self):
        self.foo = 123

    def get_me(self) -> Foo:
        return self

According to https://www.python.org/dev/peps/pep-0484/#forward-references, this should be written as:

class Foo:
    def __init__(self):
        self.foo = 123

    def get_me(self) -> 'Foo':
        return self
@JukkaL JukkaL added the bug mypy got something wrong label Dec 1, 2015
@JukkaL
Copy link
Collaborator

JukkaL commented Dec 1, 2015

Yeah, mypy should catch this issue. I think that there may be a duplicate issue about this open already. At least I remember a discussion about this.

@ilevkivskyi
Copy link
Member

Duplicate of #3088

@ilevkivskyi ilevkivskyi marked this as a duplicate of #3088 Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants