Skip to content

Commit 7a0e7b9

Browse files
h-joocopybara-github
authored andcommitted
Add a test case to confirm that an implied typing.TypeVar doesn't hide an existing symbol.
PiperOrigin-RevId: 756296804
1 parent 9df32fb commit 7a0e7b9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pytype/tests/test_typevar1.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,16 @@ def f(x):
850850
""")
851851
self.assertErrorRegexes(errors, {"e": "Expected.*int.*Actual.*str"})
852852

853+
@test_utils.skipBeforePy((3, 12), "PEP 695 - 3.12 feature")
854+
def test_global_var_not_hidden_by_type_variable(self):
855+
self.Check("""
856+
Apple: str = 'Apple'
857+
type AppleBox[Apple] = tuple[Apple, ...]
858+
def print_apple(a: str):
859+
print(a)
860+
print_apple(Apple)
861+
""")
862+
853863

854864
if __name__ == "__main__":
855865
test_base.main()

0 commit comments

Comments
 (0)