Skip to content

New semantic analyzer: fix false positives from TypedDict in stub#7063

Merged
JukkaL merged 2 commits intomasterfrom
semanal-tdict-stub
Jun 25, 2019
Merged

New semantic analyzer: fix false positives from TypedDict in stub#7063
JukkaL merged 2 commits intomasterfrom
semanal-tdict-stub

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jun 25, 2019

Fixes #7028.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Makes sense.

if typ.declared_metaclass and typ.declared_metaclass.type.fullname() == 'abc.ABCMeta':
return
if typ.is_protocol:
if typ.is_protocol or typ.typeddict_type:
Copy link
Member

Choose a reason for hiding this comment

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

I am curious why this is not needed in the old analyzer. Is it an old analyzer bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that the old semantic analyzer just doesn't run this code at all for TypedDicts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the code to be closer to the logic in the old semantic analyzer.

@JukkaL JukkaL merged commit f24119f into master Jun 25, 2019
@JelleZijlstra JelleZijlstra deleted the semanal-tdict-stub branch June 25, 2019 16:45
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.

Using TypedDict in stub files with new analyzer produces error

2 participants