Skip to content

(🎁) narrow falsey string to Literal[""] #16891

@KotlinIsland

Description

@KotlinIsland
from typing import Literal

def f() -> Literal[""]:
    a = ""
    return a and exit()  # error: Incompatible return value type (got "str", expected "Literal['']")  [return-value]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions