-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or request
Description
from typing import NewType
A = NewType("A", int)
B = NewType("B", str)
def test(x: A | B):
match x:
case A():
print("A")
case B():
print("B")
test(A(123))
"""
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
test(A(123))
~~~~^^^^^^^^
File "<stdin>", line 3, in test
case A():
~^^
TypeError: called match pattern must be a class
"""This code causes an exception at runtime, but pyright doesn't produce any errors.
Related: #6828
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or request