Describe the bug
When a type annotation is an exact string match for a class name defined elsewhere in the file, it is falsely reported as a circular reference.
To Reproduce
See code below for a minimal repro case.
Expected behavior
PEP-0563 indicates that I should expect that the type hint would only match names in the module scope.
See https://www.python.org/dev/peps/pep-0563/#implementation
Screenshots or Code
class A:
A: 'str'
class B:
A: 'A'
The above code produces the following error:
bad_match.py:5:9 - error: Type of "A" could not be determined because it refers to itself (reportGeneralTypeIssues)
This should correctly evaluate to class A rather than the class member A
VS Code extension or command-line
Running pyright 1.1.191 on the command line.
Additional context
None
Describe the bug
When a type annotation is an exact string match for a class name defined elsewhere in the file, it is falsely reported as a circular reference.
To Reproduce
See code below for a minimal repro case.
Expected behavior
PEP-0563 indicates that I should expect that the type hint would only match names in the module scope.
See https://www.python.org/dev/peps/pep-0563/#implementation
Screenshots or Code
The above code produces the following error:
bad_match.py:5:9 - error: Type of "A" could not be determined because it refers to itself (reportGeneralTypeIssues)This should correctly evaluate to
class Arather than the class memberAVS Code extension or command-line
Running pyright 1.1.191 on the command line.
Additional context
None