Skip to content

Overloads using enum literals returning unexpected type #1982

@kymckay

Description

@kymckay

Describe the Bug

When running type checking with pyrefly, I expect to see the type of expected_bool inferred to be a bool because of the overload on the enum literal. However, it's giving the generic union fallback typing instead.

This pattern is one I've been successfully using with pyright so that I can strongly type my environment variable usage (I codegen all the overloads into a .pyi file). It's not a complete blocker to pyrefly adoption, but is a pain point.

Sandbox Link

Sandbox Link

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions