Python: Add false positive test example for issue #2652.

This commit is contained in:
Taus Brock-Nannestad
2020-01-21 15:28:01 +01:00
parent 9193a81e1a
commit ead687da06
2 changed files with 12 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
| 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. |

View File

@@ -0,0 +1,11 @@
# FP Type annotation counts as redefinition
# See https://github.com/Semmle/ql/issues/2652
def type_annotation(x):
foo = 5
if x:
foo : int
do_stuff_with(foo)
else:
foo : float
do_other_stuff_with(foo)