Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3k
Open
Description
classFoo: ...classBar(Foo): ...deftest_1(bar:Bar)->None:matchbar:caseFoo()asfoo:reveal_type(foo)# N: Revealed type is "__main__.Bar"deftest_2(bar:Bar|str)->None:matchbar:caseFoo()asfoo:reveal_type(foo)# N: Revealed type is "__main__.Foo"deftest_3(bar:Bar)->None:ifisinstance(bar,Foo):reveal_type(bar)# N: Revealed type is "__main__.Bar"deftest_4(bar:Bar|str)->None:ifisinstance(bar,Foo):reveal_type(bar)# N: Revealed type is "__main__.Bar"
https://mypy-play.net/?mypy=latest&python=3.12&gist=4bc28e67967c7809ccdd0962f3372dd7