Skip to content

UnsetType union types lowering is incomplete #916

@CharString

Description

@CharString

Description

from typing import assert_type
from msgspec import UnsetType


def f(s: str | UnsetType):
    if s:
        assert_type(s, str)  # this fails

UNSET is the only UnsetType value and bool(UNSET) is False. Therefore the if statement should narrow the type of s to str.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions