Skip to content

Fix function containing PEP 593 Annotated with a string literal second arg causing 'Name "x" is not defined" error #10777

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
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
Add test case
  • Loading branch information
97littleleaf11 committed Nov 26, 2021
commit b238162ce15574995fa3fcd923eec337067e06b9
5 changes: 5 additions & 0 deletions test-data/unit/check-annotated.test
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ reveal_type(x) # N: Revealed type is "def () -> builtins.int"
[builtins fixtures/tuple.pyi]

[case testAnnotatedStringLiteralInFunc]
from typing import TypeVar
from typing_extensions import Annotated
def f1(a: Annotated[str, "metadata"]):
pass
Expand All @@ -137,6 +138,10 @@ def f2(a: Annotated["str", "metadata"]):
reveal_type(f2) # N: Revealed type is "def (a: builtins.str) -> Any"
def f3(a: Annotated["notdefined", "metadata"]): # E: Name "notdefined" is not defined
pass
T = TypeVar('T')
def f4(a: Annotated[T, "metatdata"]):
pass
reveal_type(f4) # N: Revealed type is "def [T] (a: T`-1) -> Any"
[builtins fixtures/tuple.pyi]

[case testSliceAnnotated39]
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy