Skip to content

Commit 3f00414

Browse files
committed
more
1 parent d94972c commit 3f00414

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test-data/unit/check-narrowing.test

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2742,6 +2742,7 @@ def foo(x: dict[str, Any]) -> bool:
27422742

27432743

27442744
[case testNarrowingTypeObjects]
2745+
# flags: --warn-unreachable
27452746
from __future__ import annotations
27462747
from typing import Callable, Any, TypeVar, Generic, Protocol
27472748
_T_co = TypeVar('_T_co', covariant=True)
@@ -2768,7 +2769,10 @@ def main(key: str):
27682769
existing_value_type = get_type(key)
27692770
if existing_value_type is TupleLike:
27702771
reveal_type(TupleLike) # N: Revealed type is "def [_T_co] (__main__.Boxxy[_T_co`1]) -> __main__.TupleLike[_T_co`1]"
2771-
TupleLike(Box2("str"))
2772+
reveal_type(TupleLike(Box2("str"))) # N: Revealed type is "__main__.TupleLike[builtins.str]"
2773+
2774+
reveal_type(existing_value_type) # N: Revealed type is "(def [_T_co] (__main__.Boxxy[_T_co`1]) -> __main__.TupleLike[_T_co`1]) | type[Any]"
2775+
reveal_type(existing_value_type(Box2("str"))) # N: Revealed type is "__main__.TupleLike[builtins.str] | Any"
27722776
[builtins fixtures/tuple.pyi]
27732777

27742778
[case testNarrowingCollections]

0 commit comments

Comments
 (0)