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

False positive on mutual recursion involving a type alias #3418

Closed
JelleZijlstra opened this issue May 23, 2017 · 2 comments
Closed

False positive on mutual recursion involving a type alias #3418

JelleZijlstra opened this issue May 23, 2017 · 2 comments

Comments

@JelleZijlstra
Copy link
Member

This produces an error but (I think) shouldn't:

from typing import List

class A(object):
    b: 'B'  # E: Invalid type "recurse.B"

B = List[A]

It works fine if I make B a class, even a class inheriting from A. I encountered this in https://github.com/JelleZijlstra/typeshed_client/blob/master/typeshed_client/parser.py#L30 (A is NameInfo and B is NameDict).

@ilevkivskyi
Copy link
Member

I think this is essentially a duplicate of #2241. It is actually more difficult than it may look. It is "entangled" with several other issues with forward references and might need another pass in semanal.py (I am going to work on this after the protocol PR is merged).

I propose to close this issue and track this in #2241 (after copying this example there). Do you agree?

@JelleZijlstra
Copy link
Member Author

Thanks, you're right. Sorry for missing the duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants