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

Error initializing Union of Lists with an empty list #2164

Closed
elazarg opened this issue Sep 21, 2016 · 3 comments
Closed

Error initializing Union of Lists with an empty list #2164

elazarg opened this issue Sep 21, 2016 · 3 comments

Comments

@elazarg
Copy link
Contributor

elazarg commented Sep 21, 2016

The following test case

[case testUnionListInit]
from typing import Union, List
a = []  # type: Union[List[int], List[str]]
[builtins fixtures/list.pyi]

Results in

Expected:
Actual:
  main:2: error: Incompatible types in assignment (expression has type List[None], variable has type "Union[List[int], List[str]]") (diff)

This came up during PR #2154, but I think is an independent issue.

@elazarg elazarg changed the title Error Error initializing Union of Lists with an empty list Sep 21, 2016
@elazarg
Copy link
Contributor Author

elazarg commented Sep 21, 2016

Perhaps related to binder.py#L189?

@gvanrossum
Copy link
Member

Doesn't sound like a very important issue, the example has questionable value. (I'm not saying it's not a bug -- just that I don't think it's urgent to fix it.)

@JukkaL
Copy link
Collaborator

JukkaL commented Mar 29, 2019

Closing in favor of duplicate #6463 (the latter issue has a slight more interesting example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants