Skip to content

Overlapping unions creates issues with inference #7579

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

Closed
yilinwei opened this issue Sep 28, 2019 · 1 comment
Closed

Overlapping unions creates issues with inference #7579

yilinwei opened this issue Sep 28, 2019 · 1 comment

Comments

@yilinwei
Copy link

  • version: 7.3.0

When creating a union which has overlapping types, the inference fails. Either this should throw an error, or it should be inferred correctly.

from typing import TypeVar, Union, Iterable, List

T = TypeVar("T")

def foo(test: Union[T, List[T]]):
    pass

foo([1]) # Fails with incompatible type List[<nothing>]
  • Example of misuse here
@ilevkivskyi
Copy link
Member

Duplicate of #6417

@ilevkivskyi ilevkivskyi marked this as a duplicate of #6417 Sep 28, 2019
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

No branches or pull requests

2 participants