Skip to content

Cannot access nested class #259

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
JukkaL opened this issue Sep 21, 2013 · 4 comments
Closed

Cannot access nested class #259

JukkaL opened this issue Sep 21, 2013 · 4 comments
Labels
bug mypy got something wrong

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Sep 21, 2013

The type checker complains about the self.B() call in the program below:

class A:
    class B: pass
    def f(self) -> None:
        self.B()
@JukkaL
Copy link
Collaborator Author

JukkaL commented Oct 25, 2014

Actually, it's not obvious how this should work, as plausibly a subclass of A could override B... or maybe that should be forbidden? Currently you can use A.B as a simple workaround.

This needs further analysis, so removed the 'priority' label.

@ilevkivskyi
Copy link
Member

Another example of this bug:

class Outer:
    class Inner:
        pass

Outer().Inner  # E: Member "Inner" is not assignable

@emmatyping
Copy link
Member

emmatyping commented Jul 1, 2017

This is the same as #3635 fixed in #3636, unless I'm mistaken, so it is resolved.

@ilevkivskyi
Copy link
Member

Yes, both examples work correctly now.

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