Open
Description
Bug description
type IntOrX = int | X
class X:
pass
Configuration
No response
Command used
pylint --py-version=3.12 asdf.py
Pylint output
asdf.py:1:20: E0601: Using variable 'X' before assignment (used-before-assignment)
Expected behavior
No warning
The value of the type alias is evaluated in the annotation scope. It is not evaluated when the type alias is created, but only when the value is accessed through the type alias’s value attribute (see Lazy evaluation). This allows the type alias to refer to names that are not yet defined.
https://docs.python.org/3/reference/simple_stmts.html#the-type-statement
Pylint version
pylint 3.3.0-dev0
astroid 3.3.0-dev0
Python 3.12.3
OS / Environment
No response
Additional dependencies
No response