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
2 changes: 1 addition & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7678,7 +7678,7 @@ def refers_to_fullname(node: Expression, fullnames: str | tuple[str, ...]) -> bo
return False
if node.fullname in fullnames:
return True
if isinstance(node.node, TypeAlias):
if isinstance(node.node, TypeAlias) and not node.node.python_3_12_type_alias:
return is_named_instance(node.node.target, fullnames)
return False

Expand Down
16 changes: 16 additions & 0 deletions test-data/unit/check-python312.test
Original file line number Diff line number Diff line change
Expand Up @@ -2095,3 +2095,19 @@ from dataclasses import dataclass
class Test[*Ts, R]:
a: Callable[[*Ts], R]
[builtins fixtures/dict.pyi]

[case testPEP695AliasDoesNotReferToFullname]
# https://github.com/python/mypy/issues/19698
from typing import TypeAliasType
type D = dict
type T = type
type TA = TypeAliasType

D() # E: "TypeAliasType" not callable
X = TA("Y") # E: "TypeAliasType" not callable

x: object
if T(x) is str: # E: "TypeAliasType" not callable
reveal_type(x) # N: Revealed type is "builtins.object"
[builtins fixtures/tuple.pyi]
[typing fixtures/typing-full.pyi]
Loading