Skip to content

Fix invalid type causing namedtuple errors in wrong files - #8549

Merged
msullivan merged 2 commits into
masterfrom
namedtuple-wrongfile
Mar 17, 2020
Merged

msullivan merged 2 commits into
masterfrom
namedtuple-wrongfile

Conversation

@msullivan

Copy link
Copy Markdown
Collaborator

Fixes #8511.

This is a workaround of #4987, where UnboundTypes can leak.

@msullivan
msullivan requested review from JukkaL and Michael0x2a March 17, 2020 00:00

@Michael0x2a Michael0x2a left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think UnboundTypes leaking is by design, right? (Though I do agree this design isn't great/we need tighter semantics around creating placeholders for bad types.)

But anyways, this fix LGTM. It's a bit unfortunate that the one failing test's reveal_type output degraded slightly, but I think that's fine.

Comment thread test-data/unit/check-namedtuple.test Outdated
def foo():
pass

Type1 = NamedTuple('Type1', [('foo', foo)]) # type: ignore

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead we check the error message that's generated here to make sure it's something sensible?

Fixes #8511.

This is a workaround of #4987, where UnboundTypes can leak.
@msullivan
msullivan force-pushed the namedtuple-wrongfile branch from 9ce419f to 4affc8a Compare March 17, 2020 00:57
@msullivan
msullivan merged commit 7f8ea4a into master Mar 17, 2020
@msullivan
msullivan deleted the namedtuple-wrongfile branch March 17, 2020 21:07
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

Successfully merging this pull request may close these issues.

Wrong file blamed for a mixture of NamedTuple and passing a function instead of type.

2 participants