Skip to content

Commit

Permalink
Python: Expand type-tracking tuple tests with nested tuples
Browse files Browse the repository at this point in the history
Which surprisingly doesn't work. Also has quite a few consistency errors
:O
  • Loading branch information
RasmusWL committed Mar 12, 2024
1 parent 4d9db41 commit 6811d73
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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. |
22 changes: 22 additions & 0 deletions python/ql/test/experimental/dataflow/typetracking/content_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6811d73

Please sign in to comment.