Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix type inference of positional parameter in class pattern involving…
… builtin subtype (#18141) Fixes #18140 ### Demo ```python from typing import reveal_type class A(str): pass class B(str): __match_args__ = ("b",) @Property def b(self) -> int: return 1 match A("a"): case A(a): reveal_type(a) # before: Revealed type is "__main__.A" # after: Revealed type is "__main__.A" print(type(a)) # output: <class '__main__.A'> match B("b"): case B(b): reveal_type(b) # before: Revealed type is "__main__.B" # after: Revealed type is "builtins.int" print(type(b)) # output: <class 'int'> ```
- Loading branch information