8000 Fix `typing.TypeAliasType` being undefined on python < 3.12 by sobolevn · Pull Request #17558 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix typing.TypeAliasType being undefined on python < 3.12 #17558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Fix CI
  • Loading branch information
sobolevn committed Jul 22, 2024
commit 0db0b481689cf2723689fc43345a69f4309f3ca2
4 changes: 2 additions & 2 deletions test-data/unit/check-type-aliases.test
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ x: TestType = 42
y: TestType = 'a'
z: TestType = object() # E: Incompatible types in assignment (expression has type "object", variable has type "Union[int, str]")

reveal_type(TestType) # N: Revealed type is "typing.TypeAliasType"
reveal_type(TestType) # N: Revealed type is "typing_extensions.TypeAliasType"
TestType() # E: "TypeAliasType" not callable

class A:
Expand All @@ -1086,7 +1086,7 @@ yc: A.ClassAlias = "" # E: Incompatible types in assignment (expression has typ

[case testTypeAliasTypePython311]
# flags: --python-version 3.11
# Pinning to 3.11, because 3.12 have `TypeAliasType`
# Pinning to 3.11, because 3.12 has `TypeAliasType`
from typing_extensions import TypeAliasType

TestType = TypeAliasType("TestType", int)
Expand Down
Loading
0