diff options
| author | Andrew Simmons <a.simmons@deakin.edu.au> | 2020-04-20 23:36:26 +1000 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-04-22 08:26:43 +0200 |
| commit | aa1940e35a8c78cc362f112b6bf498f97ee6640d (patch) | |
| tree | ded8e0db3bd1bc0b5c422784d630e86226c76eab /pylint/checkers/variables.py | |
| parent | d1484608e89c3e7e2900183e9fb9cbc183de1fb5 (diff) | |
| download | pylint-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.py | 4 |
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 |
