summaryrefslogtreecommitdiff
path: root/tests/functional/c
diff options
context:
space:
mode:
authorAndrew Simmons <anjsimmo@gmail.com>2020-07-13 01:37:53 +1000
committerGitHub <noreply@github.com>2020-07-12 17:37:53 +0200
commitb0824e94019ac86df0164bba26389488090479e5 (patch)
treead34c79b68d77ea72f16285d4228947d5f18dc81 /tests/functional/c
parentb1f0a930d347b8e4fe04c500c3201f1960b7a8f8 (diff)
downloadpylint-git-b0824e94019ac86df0164bba26389488090479e5.tar.gz
Fix scoping for function annotations, decorators and base classes (#3713)
Fix scoping for function annotations, decorators and base classes Closes #1082, #3434, #3461 Reduce number of branches in variables checker Co-authored-by: Andrew Simmons <a.simmons@deakin.edu.au>
Diffstat (limited to 'tests/functional/c')
-rw-r--r--tests/functional/c/class_scope.py20
-rw-r--r--tests/functional/c/class_scope.txt1
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/functional/c/class_scope.py b/tests/functional/c/class_scope.py
index 527e5efa2..4e1561c9a 100644
--- a/tests/functional/c/class_scope.py
+++ b/tests/functional/c/class_scope.py
@@ -21,3 +21,23 @@ class Well(object):
def func(self):
"""check Sub is not defined here"""
return Sub(), self # [undefined-variable]
+
+
+class Right:
+ """right"""
+ class Result1:
+ """result one"""
+ OK = 0
+ def work(self) -> Result1:
+ """good type hint"""
+ return self.Result1.OK
+
+
+class Wrong:
+ """wrong"""
+ class Result2:
+ """result two"""
+ OK = 0
+ def work(self) -> self.Result2: # [undefined-variable]
+ """bad type hint"""
+ return self.Result2.OK
diff --git a/tests/functional/c/class_scope.txt b/tests/functional/c/class_scope.txt
index 348c2b510..decd708c2 100644
--- a/tests/functional/c/class_scope.txt
+++ b/tests/functional/c/class_scope.txt
@@ -4,3 +4,4 @@ undefined-variable:13:Well.<lambda>:Undefined variable 'get_attr_bad'
undefined-variable:14:Well:Undefined variable 'attr'
undefined-variable:20:Well.Sub:Undefined variable 'Data'
undefined-variable:23:Well.func:Undefined variable 'Sub'
+undefined-variable:41:Wrong.work:Undefined variable 'self'