Skip to content

No error on new union syntax with union of fake types (TypeAlias and None) #11582

Open
@KotlinIsland

Description

@KotlinIsland
from typing import TypeAlias

AMONGUS: TypeAlias = "int"
IMPOSTER: TypeAlias = "str"

a: AMONGUS | IMPOSTER = 0  # SUS ALERT
b: AMONGUS | None = None  # SUS ALERT

Any types in a new union syntax that are fake(looking at you None) will be runtime errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-pep-604PEP 604 (union | operator)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions