Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bad 'Incompatible types in assignment' error for a type alias containing Union #2485

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
davire opened this issue Nov 24, 2016 · 1 comment
Closed

Comments

@davire
Copy link

davire commented Nov 24, 2016

There is this code that doesn't typecheck and I don't understand why:

W = Dict[str, Union[bool,int, float]]


def test2() -> W:
    rest = {}  # type: W
    return rest

However it typechecks if I remove either one of bool, int, float in the type W

@rwbarton
Copy link
Contributor

Indeed, it's a bug. Duplicate of #1850.

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