8000 Fix 0.750 regression: union (non-)simplification should not affect inference by ilevkivskyi · Pull Request #8077 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@ilevkivskyi
Copy link
Member

Fixes #8051

The fix is as discussed in the issue. I didn't find a test case for the union actual, but I think it makes sense to simplify it as well. Note: I add the pythoneval test just as a regression test, if you think it is not worth it, I can remove it.

@ilevkivskyi ilevkivskyi requested a review from JukkaL December 4, 2019 16:54
Copy link
Collaborator
@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member
@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix!

template = get_proper_type(template)
actual = get_proper_type(actual)

# Type inference shouldn't be affected by whether union types have bee simplified.
Copy link
Member

Choose a reason for hiding this comment

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

typo: been

if int():
a = narrow_none(a)
reveal_type(a) # N: Revealed type is 'Union[builtins.int, None]'
reveal_type(a) # N: Revealed type is 'builtins.int'
Copy link
Member

Choose a reason for hiding this comment

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

This is a nice improvement too.

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.

mypy 0.750 regression with asyncio.wait

3 participants

0