8000 Fix "Implicit type aliases not recognised with PEP 604 + import cycles" (but only for stubs) by AlexWaygood · Pull Request #11915 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix "Implicit type aliases not recognised with PEP 604 + import cycles" (but only for stubs) #11915

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 8 commits into from
Jan 30, 2022
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
Next Next commit
Fix merge conflicts
  • Loading branch information
AlexWaygood committed Jan 20, 2022
commit 7eac5925c08c94e9924f9cd2216a53cea5f4bb41
14 changes: 13 additions & 1 deletion test-data/unit/pythoneval.test
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,18 @@ reveal_type(x) # Revealed type is "collections.OrderedDict[builtins.str, builti
[out]
_testTypingExtensionsOrderedDictAlias.py:3: note: Revealed type is "collections.OrderedDict[builtins.str, builtins.str]"

[case testEnumValueWithPlaceholderNodeType]
# https://github.com/python/mypy/issues/11971
from enum import Enum
from typing import Callable, Dict
class Foo(Enum):
Bar: Foo = Callable[[str], None]
Baz: Foo = Callable[[Dict[str, "Missing"]], None]
[out]
_testEnumValueWithPlaceholderNodeType.py:5: error: Incompatible types in assignment (expression has type "object", variable has type "Foo")
_testEnumValueWithPlaceholderNodeType.py:6: error: Incompatible types in assignment (expression has type "object", variable has type "Foo")
_testEnumValueWithPlaceholderNodeType.py:6: error: Name "Missing" is not defined

[case testImplicit604TypeAliasWithCyclicImport]
from was_builtins import foo
reveal_type(foo)
Expand All @@ -1597,4 +1609,4 @@ from was_builtins import *
import was_abc
import was_collections
[out]
_testImplicit604TypeAliasWithCyclicImport.py:2: note: Revealed type is "Union[builtins.str, was_mmap.mmap]"
_testImplicit604TypeAliasWithCyclicImport.py:2: note: Revealed type is "Union[builtins.str, was_mmap.mmap]"
You are viewing a condensed version of this merge commit. You can view the full changes here.
0