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

Fix incorrect "Incompatible types in capture pattern" error for narrowed types #18155

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shenyih0ng
Copy link
Contributor

@shenyih0ng shenyih0ng commented Nov 14, 2024

Fixes #16736

  • Handle guards when inferring capture variable types
  • Add unit test

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

Expression (https://github.com/cognitedata/Expression)
+ expression/extra/parser.py:263: error: Class "expression.collections.block.Block[Any]" has no attribute "_value"  [misc]
+ expression/extra/parser.py:264: error: Cannot determine type of "tail"  [has-type]
+ expression/extra/parser.py:265: error: Cannot determine type of "head"  [has-type]

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.

match: Incorrect "Incompatible types in capture pattern" when type has already been narrowed
1 participant