crates/ty_python_semantic/resources/mdtest/diagnostics/unresolved_reference.md
[environment]
python-version = "3.12"
PythonFinalizationError # error: [unresolved-reference]
A special diagnostic is emitted when using a deprecated alias from Typing that is builtin in this version of Python. (full diagnostic captured in snapshot)
[environment]
python-version = "3.9"
foo: List[int] # snapshot: unresolved-reference
bar: Type # snapshot: unresolved-reference
error[unresolved-reference]: Name `List` used when not defined
--> src/mdtest_snippet.py:1:6
|
1 | foo: List[int] # snapshot: unresolved-reference
| ^^^^ Did you mean `list`?
help: Replace with `list`
|
- foo: List[int] # snapshot: unresolved-reference
1 + foo: list[int] # snapshot: unresolved-reference
2 | bar: Type # snapshot: unresolved-reference
|
note: This is an unsafe fix and may change runtime behavior
error[unresolved-reference]: Name `Type` used when not defined
--> src/mdtest_snippet.py:2:6
|
2 | bar: Type # snapshot: unresolved-reference
| ^^^^ Did you mean `type`?
help: Replace with `type`
|
1 | foo: List[int] # snapshot: unresolved-reference
- bar: Type # snapshot: unresolved-reference
2 + bar: type # snapshot: unresolved-reference
|
note: This is an unsafe fix and may change runtime behavior
A module-level binding named list also shadows the standard builtin inside a nested function, so
the unresolved List annotation cannot safely be replaced with list.
list = object
def check():
value: List[int] # snapshot: unresolved-reference
error[unresolved-reference]: Name `List` used when not defined
--> src/mdtest_snippet.py:4:12
|
4 | value: List[int] # snapshot: unresolved-reference
| ^^^^ Did you mean `list`?
[environment]
python-version = "3.8"
foo: List[int] # error: [unresolved-reference]
bar: Type # error: [unresolved-reference]