diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/BinaryOperationNodes.expected b/ql/test/library-tests/semmle/go/dataflow/Nodes/BinaryOperationNodes.expected index dbc7327f186..9d996bdd020 100644 --- a/ql/test/library-tests/semmle/go/dataflow/Nodes/BinaryOperationNodes.expected +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/BinaryOperationNodes.expected @@ -1,3 +1,4 @@ | main.go:7:14:7:24 | ...+... | + | main.go:7:14:7:14 | x | main.go:7:19:7:23 | ...+... | | main.go:7:19:7:23 | ...+... | + | main.go:7:19:7:19 | y | main.go:7:23:7:23 | z | -| main.go:15:2:15:13 | ... += ... | + | main.go:15:2:15:6 | index expression | main.go:15:11:15:13 | "!" | +| main.go:10:14:10:18 | ...+... | + | main.go:10:14:10:14 | x | main.go:10:18:10:18 | y | +| main.go:17:2:17:13 | ... += ... | + | main.go:17:2:17:6 | index expression | main.go:17:11:17:13 | "!" | diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode.expected b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode.expected index 5a3836d14a5..cbd18610584 100644 --- a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode.expected +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode.expected @@ -1,4 +1,6 @@ | main.go:7:2:7:25 | call to Println | | main.go:8:5:8:7 | call to f | -| main.go:12:8:12:24 | call to make | -| main.go:14:2:14:26 | call to Println | +| main.go:9:9:9:14 | call to test | +| main.go:10:2:10:19 | call to Println | +| main.go:14:8:14:24 | call to make | +| main.go:16:2:16:26 | call to Println | diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getArgument.expected b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getArgument.expected index 9d2c1e18ecc..fc391bafcff 100644 --- a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getArgument.expected +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getArgument.expected @@ -1,5 +1,6 @@ | main.go:7:2:7:25 | call to Println | 0 | main.go:7:14:7:24 | ...+... | -| main.go:12:8:12:24 | call to make | 0 | main.go:12:23:12:23 | 1 | -| main.go:14:2:14:26 | call to Println | 0 | main.go:14:14:14:15 | ss | -| main.go:14:2:14:26 | call to Println | 1 | main.go:14:18:14:18 | 0 | -| main.go:14:2:14:26 | call to Println | 2 | main.go:14:21:14:25 | index expression | +| main.go:10:2:10:19 | call to Println | 0 | main.go:10:14:10:18 | ...+... | +| main.go:14:8:14:24 | call to make | 0 | main.go:14:23:14:23 | 1 | +| main.go:16:2:16:26 | call to Println | 0 | main.go:16:14:16:15 | ss | +| main.go:16:2:16:26 | call to Println | 1 | main.go:16:18:16:18 | 0 | +| main.go:16:2:16:26 | call to Println | 2 | main.go:16:21:16:25 | index expression | diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult.expected b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult.expected new file mode 100644 index 00000000000..d9aa7ade978 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult.expected @@ -0,0 +1 @@ +| main.go:14:8:14:24 | call to make | main.go:14:8:14:24 | call to make | diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult.ql b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult.ql new file mode 100644 index 00000000000..5d6c0ff9043 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult.ql @@ -0,0 +1,5 @@ +import go + +from DataFlow::CallNode c, DataFlow::Node outp +where outp = c.getResult() +select c, outp diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult_int.expected b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult_int.expected new file mode 100644 index 00000000000..561ee68e9f7 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult_int.expected @@ -0,0 +1,2 @@ +| main.go:9:9:9:14 | call to test | 0 | main.go:9:2:9:14 | ... = ...[0] | +| main.go:9:9:9:14 | call to test | 1 | main.go:9:2:9:14 | ... = ...[1] | diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult_int.ql b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult_int.ql new file mode 100644 index 00000000000..b0124d3c56b --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/CallNode_getResult_int.ql @@ -0,0 +1,5 @@ +import go + +from DataFlow::CallNode c, int i, DataFlow::Node outp +where outp = c.getResult(i) +select c, i, outp diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/main.go b/ql/test/library-tests/semmle/go/dataflow/Nodes/main.go index f576f2cd3f3..1fb3466820c 100644 --- a/ql/test/library-tests/semmle/go/dataflow/Nodes/main.go +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/main.go @@ -6,6 +6,8 @@ func main() { x, y, z := 1, 2, 3 fmt.Println(x + (y + z)) go f() + x, y = test() + fmt.Println(x + y) } func f() { @@ -14,3 +16,7 @@ func f() { fmt.Println(ss, 0, ss[0]) ss[0] += "!" } + +func test() (int, int) { + return 23, 42 +}