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 type analyzer: confusing error message for broken named tuple #6956

Open
ilevkivskyi opened this issue Jun 7, 2019 · 0 comments
Open
Assignees
Labels
bug mypy got something wrong priority-1-normal semantic-analyzer Problems that happen during semantic analysis topic-named-tuple

Comments

@ilevkivskyi
Copy link
Member

This test case fails:

[case testInvalidNamedTupleBaseClass]
from typing import NamedTuple

defer: Yes

class A(NamedTuple('N', [1])): pass # E: Tuple expected as NamedTuple() field

class Yes: ...

because there is a spurious additional error

main:5: error: Name 'namedtuple@5' already defined on line 5

See also #6422 that may be related (broken named tuples, and named tuples at function scope use similar logic).

@ilevkivskyi ilevkivskyi added bug mypy got something wrong topic-named-tuple priority-1-normal semantic-analyzer Problems that happen during semantic analysis labels Jun 7, 2019
@JukkaL JukkaL self-assigned this 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 topic-named-tuple
Projects
None yet
Development

No branches or pull requests

2 participants