Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4085,6 +4085,7 @@ def analyze_type_application(self, expr: IndexExpr) -> None:
name = target.type.fullname
if (alias.no_args and # this avoids bogus errors for already reported aliases
name in get_nongen_builtins(self.options.python_version) and
not self.is_stub_file and
not alias.normalized):
self.fail(no_subscript_builtin_alias(name, propose_alt=False), expr)
# ...or directly.
Expand Down
11 changes: 11 additions & 0 deletions test-data/unit/check-generic-alias.test
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,14 @@ class C(list[int]):
pass
d: type[str]
[builtins fixtures/list.pyi]


[case testTypeAliasWithBuiltinListAliasInStub]
# flags: --python-version 3.6
import m
reveal_type(m.a()[0]) # N: Revealed type is "builtins.int*"

[file m.pyi]
List = list
a = List[int]
[builtins fixtures/list.pyi]