Skip to content

improve enum error suggestion #3128

@asukaminato0721

Description

@asukaminato0721

Describe the Bug

from enum import StrEnum

class T(StrEnum):
    A = "a"

def f(t: T):
    ...
f("a")

current:
Argument Literal['a'] is not assignable to parameter t with type T in function f [bad-argument-type]

hope:
function f require t: T, but get "a", do you mean T.A ?

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedLarger than "good first issue", but still well-defined and ready for someone to pick up
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions