You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reveal_type(arg) # N: Revealed type is "tuple[T`-1, fallback=__main__.D[Any]]"
2579
2579
[builtins fixtures/tuple.pyi]
2580
+
2581
+
2582
+
[case testNarrowingUnionMixins]
2583
+
class Base: ...
2584
+
2585
+
class FooMixin:
2586
+
def foo(self) -> None: ...
2587
+
2588
+
class BarMixin:
2589
+
def bar(self) -> None: ...
2590
+
2591
+
def baz(item: Base) -> None:
2592
+
if not isinstance(item, (FooMixin, BarMixin)):
2593
+
raise
2594
+
2595
+
reveal_type(item) # N: Revealed type is "Union[__main__.<subclass of "__main__.Base" and "__main__.FooMixin">, __main__.<subclass of "__main__.Base" and "__main__.BarMixin">]"
2596
+
if isinstance(item, FooMixin):
2597
+
reveal_type(item) # N: Revealed type is "__main__.FooMixin"
2598
+
item.foo()
2599
+
else:
2600
+
reveal_type(item) # N: Revealed type is "__main__.<subclass of "__main__.Base" and "__main__.BarMixin">"
0 commit comments