-
Notifications
You must be signed in to change notification settings - Fork 281
Closed as not planned
Description
Describe the Bug
When trying to assign to a list a type that is narrower than the original list, it doesn't work.
class A:pass
class B: pass
def t(self, l1: list[A | B], l2: list[B], e1: A| B, e2: B):
l1 = l2 # Fail, despite "A" being subtype of "A | B"
e1 = e2 # No error there.
l1.extend(l2) # No error there.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels