mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
Python: Expand type-tracking tests with nested tuples
I was initially surprised to see that this didn't work, until I remembered that type-tracking only works with content of depth 1.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
unreachableNode
|
||||
| content_test.py:31:6:31:11 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 0. |
|
||||
| content_test.py:31:6:31:11 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 1. |
|
||||
| content_test.py:31:6:31:11 | ControlFlowNode for Tuple | Unreachable node in step of kind storeTarget. |
|
||||
| content_test.py:31:16:31:21 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 0. |
|
||||
| content_test.py:31:16:31:21 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 1. |
|
||||
| content_test.py:31:16:31:21 | ControlFlowNode for Tuple | Unreachable node in step of kind storeTarget. |
|
||||
| content_test.py:40:10:40:13 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 0. |
|
||||
| content_test.py:40:10:40:13 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 1. |
|
||||
| content_test.py:40:10:40:13 | ControlFlowNode for Tuple | Unreachable node in step of kind storeTarget. |
|
||||
| content_test.py:66:9:66:12 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 0. |
|
||||
| content_test.py:66:9:66:12 | ControlFlowNode for Tuple | Unreachable node in step of kind load Tuple element at index 1. |
|
||||
| content_test.py:66:9:66:12 | ControlFlowNode for Tuple | Unreachable node in step of kind storeTarget. |
|
||||
@@ -21,6 +21,28 @@ def test_tuple(index_arg):
|
||||
print(tup[i])
|
||||
|
||||
|
||||
# nested tuples
|
||||
nested_tuples = ((tracked, other), (other, tracked)) # $tracked
|
||||
|
||||
nested_tuples[0][0] # $ MISSING: tracked
|
||||
nested_tuples[0][1]
|
||||
nested_tuples[1][0]
|
||||
nested_tuples[1][1] # $ MISSING: tracked
|
||||
|
||||
(aa, ab), (ba, bb) = nested_tuples
|
||||
aa # $ MISSING: tracked
|
||||
ab
|
||||
ba
|
||||
bb # $ MISSING: tracked
|
||||
|
||||
|
||||
# non-precise access is not supported right now (and it's not 100% clear if we want
|
||||
# to support it, or if it will lead to bad results)
|
||||
for (x, y) in nested_tuples:
|
||||
x
|
||||
y
|
||||
|
||||
|
||||
def test_dict(key_arg):
|
||||
d1 = {"t": tracked, "o": other} # $tracked
|
||||
d1["t"] # $ tracked
|
||||
|
||||
Reference in New Issue
Block a user