errors.snap•1.07 kB
/TEST_OUTPUT/workspace/error_file.py
Diagnostics in File: 3
ERROR at L31:C12: Type "Literal[42]" is not assignable to return type "str"
"Literal[42]" is not assignable to "str" (Source: Pyright, Code: reportReturnType)
ERROR at L47:C15: "undefined_variable" is not defined (Source: Pyright, Code: reportUndefinedVariable)
ERROR at L51:C19: Type "Literal[123]" is not assignable to declared type "str"
"Literal[123]" is not assignable to "str" (Source: Pyright, Code: reportAssignmentType)
25|def function_with_type_error() -> str:
...
29| Should return a string but actually returns an int
30| """
31| return 42 # Type error: Incompatible return value type (got "int", expected "str")
...
34|class ErrorClass:
...
45| def method_with_undefined_variable(self) -> None:
46| """A method that uses an undefined variable."""
47| print(undefined_variable) # Error: undefined_variable is not defined
...
49|
50|# Variable with incompatible type annotation
51|wrong_type: str = 123 # Type error: Incompatible types in assignment
52|