summaryrefslogtreecommitdiff
path: root/pylint/checkers/base/name_checker/checker.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/base/name_checker/checker.py')
-rw-r--r--pylint/checkers/base/name_checker/checker.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/pylint/checkers/base/name_checker/checker.py b/pylint/checkers/base/name_checker/checker.py
index 58f7198ef..56ae925fb 100644
--- a/pylint/checkers/base/name_checker/checker.py
+++ b/pylint/checkers/base/name_checker/checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Basic checker for Python code."""
@@ -476,7 +476,12 @@ class NameChecker(_BasicChecker):
# global introduced variable aren't in the function locals
if node.name in frame and node.name not in frame.argnames():
if not _redefines_import(node):
- self._check_name("variable", node.name, node)
+ if isinstance(
+ assign_type, nodes.AnnAssign
+ ) and self._assigns_typealias(assign_type.annotation):
+ self._check_name("typealias", node.name, node)
+ else:
+ self._check_name("variable", node.name, node)
# Check names defined in class scopes
elif isinstance(frame, nodes.ClassDef):