mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Merge pull request #6336 from tausbn/python-make-annotated-assignment-a-definitionnode
Python: Two fixes regarding annotated assignments
This commit is contained in:
@@ -288,3 +288,8 @@ def avoid_redundant_split(a):
|
||||
var = False
|
||||
if var:
|
||||
foo.bar() #foo is defined here.
|
||||
|
||||
def type_annotation_fp():
|
||||
annotated : annotation = [1,2,3]
|
||||
for x in annotated:
|
||||
print(x)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
| type_annotation_fp.py:5:5:5:7 | foo | The value assigned to local variable 'foo' is never used. |
|
||||
| variables_test.py:29:5:29:5 | x | The value assigned to local variable 'x' is never used. |
|
||||
| variables_test.py:89:5:89:5 | a | The value assigned to local variable 'a' is never used. |
|
||||
| variables_test.py:89:7:89:7 | b | The value assigned to local variable 'b' is never used. |
|
||||
|
||||
@@ -9,3 +9,8 @@ def type_annotation(x):
|
||||
else:
|
||||
foo : float
|
||||
do_other_stuff_with(foo)
|
||||
|
||||
def type_annotation_fn():
|
||||
# False negative: the value of `bar` is never used, but this is masked by the presence of the type annotation.
|
||||
bar = 5
|
||||
bar : int
|
||||
|
||||
Reference in New Issue
Block a user