Skip to content

Commit b47d21e

Browse files
committed
test: type keyword would fail before fix
1 parent c7f95a4 commit b47d21e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test-data/unit/check-type-aliases.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,3 +1318,25 @@ from typing_extensions import TypeAlias
13181318

13191319
Foo: TypeAlias = ClassVar[int] # E: ClassVar[...] can't be used inside a type alias
13201320
[builtins fixtures/tuple.pyi]
1321+
1322+
[case testAnnotatedWithCallableAsParameterTypeKeyword]
1323+
# flags: --python-version 3.12
1324+
from typing_extensions import Annotated
1325+
1326+
def something() -> None: ...
1327+
1328+
type A = list[Annotated[str, something()]]
1329+
a: A
1330+
reveal_type(a) # N: Revealed type is "builtins.list[builtins.str]"
1331+
[builtins fixtures/tuple.pyi]
1332+
1333+
[case testAnnotatedWithCallableAsParameterTypeAlias]
1334+
# flags: --python-version 3.12
1335+
from typing_extensions import Annotated, TypeAlias
1336+
1337+
def something() -> None: ...
1338+
1339+
B: TypeAlias = list[Annotated[str, something()]]
1340+
b: B
1341+
reveal_type(b) # N: Revealed type is "builtins.list[builtins.str]"
1342+
[builtins fixtures/tuple.pyi]

0 commit comments

Comments
 (0)