Skip to content

(🐞) New union syntax inconsistent with old union syntax, now it contains Any #12224

Description

@KotlinIsland
fromtypingimportUnionclassA:
def__init__(self, a): ...
Test1=str|A# errorTest2=Union[str, A]

main.py:5: error: Expression type contains "Any" (has type "Type[A]")
But no error on the last line

https://mypy-play.net/?mypy=latest&python=3.10&flags=disallow-any-expr&gist=dd6dcaf336fb58d4afc3310200259630

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions