summaryrefslogtreecommitdiff
path: root/pylint/checkers/variables.py
diff options
context:
space:
mode:
authorAndrew Simmons <a.simmons@deakin.edu.au>2020-04-20 23:36:26 +1000
committerClaudiu Popa <pcmanticore@gmail.com>2020-04-22 08:26:43 +0200
commitaa1940e35a8c78cc362f112b6bf498f97ee6640d (patch)
treeded8e0db3bd1bc0b5c422784d630e86226c76eab /pylint/checkers/variables.py
parentd1484608e89c3e7e2900183e9fb9cbc183de1fb5 (diff)
downloadpylint-git-aa1940e35a8c78cc362f112b6bf498f97ee6640d.tar.gz
Fix false positive for ``undefined-variable`` when using class attribute as return type annotation (#1976)
Diffstat (limited to 'pylint/checkers/variables.py')
-rw-r--r--pylint/checkers/variables.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index ac1d176ee..390bb5931 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -1261,6 +1261,10 @@ class VariablesChecker(BaseChecker):
)
or frame.args.parent_of(node)
or (frame.decorators and frame.decorators.parent_of(node))
+ or (
+ frame.returns
+ and (node is frame.returns or frame.returns.parent_of(node))
+ )
)
return in_annotation_or_default_or_decorator