-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
astral-sh/ruff
#19508Labels
narrowingrelated to flow-sensitive type narrowingrelated to flow-sensitive type narrowing
Milestone
Description
print(obj_type) here is marked as "used when possibly not defined".
class Foo:
pass
class Bar:
pass
class Baz:
pass
FooBarBaz = Foo | Bar | Baz
def func(obj: FooBarBaz):
match obj:
case Foo():
obj_type = "Foo"
case Bar():
obj_type = "Bar"
case Baz():
obj_type = "Baz"
print(obj_type)See: https://types.ruff.rs/74979412-252c-4f0a-a271-1c4fb1e6bc82
Metadata
Metadata
Assignees
Labels
narrowingrelated to flow-sensitive type narrowingrelated to flow-sensitive type narrowing