From ce94c68e0aec745fbc8aa5d6f080daca6842464b Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 8 Jul 2020 12:37:15 +0100 Subject: [PATCH] Add Go autoformatting to the 'autoformat' make target and to CI Existing gofmt complaints are fixed, and files that specifically test queries that relate to badly formatting code are tagged as such. --- .github/workflows/codeqltest.yml | 4 +- Makefile | 6 +- ql/test/consistency/test.go | 2 + .../extractor-tests/go1.13/literals.expected | 18 +- ql/test/extractor-tests/go1.13/tst.go | 2 + ql/test/extractor-tests/robustness/tst.go | 2 + .../semmle/go/Expr/BasicLit_getText.expected | 90 +- .../semmle/go/Expr/BasicLit_getValue.expected | 90 +- .../semmle/go/Expr/CompositeLit.expected | 86 +- .../semmle/go/Expr/Ident.expected | 38 +- .../library-tests/semmle/go/Expr/literals.go | 2 + .../semmle/go/PrintAst/PrintAst.expected | 1098 +++++++++-------- .../library-tests/semmle/go/PrintAst/input.go | 2 + .../ControlFlowNode_getASuccessor.expected | 596 ++++----- .../ControlFlowGraph/NoretFunctions.expected | 6 +- .../go/controlflow/ControlFlowGraph/stmts.go | 2 + .../go/controlflow/ControlFlowGraph/tst.go | 3 +- .../AlertSuppression.expected | 120 +- ql/test/query-tests/AlertSuppression/tst.go | 2 + .../AlertSuppression/tstWindows.go | 2 + .../WhitespaceContradictsPrecedence.expected | 4 +- .../WhitespaceContradictsPrecedence.go | 2 + .../WhitespaceContradictsPrecedenceGood.go | 2 + .../WhitespaceContradictsPrecedence/main.go | 14 +- 24 files changed, 1110 insertions(+), 1083 deletions(-) diff --git a/.github/workflows/codeqltest.yml b/.github/workflows/codeqltest.yml index 43323542693..44b3dfe8371 100644 --- a/.github/workflows/codeqltest.yml +++ b/.github/workflows/codeqltest.yml @@ -33,8 +33,8 @@ jobs: - name: Build run: env PATH=$PATH:$HOME/codeql make - - name: Check that all QL code is autoformatted - run: env PATH=$PATH:$HOME/codeql make AUTOFORMAT=--check-only autoformat + - name: Check that all QL and Go code is autoformatted + run: env PATH=$PATH:$HOME/codeql make QL_AUTOFORMAT=--check-only GO_AUTOFORMAT=-d autoformat - name: Test run: env PATH=$PATH:$HOME/codeql make test diff --git a/Makefile b/Makefile index 37790e81a29..6e4ccfbf76a 100644 --- a/Makefile +++ b/Makefile @@ -27,12 +27,14 @@ clean: rm -rf tools/bin tools/linux64 tools/osx64 tools/win64 tools/net tools/opencsv rm -rf $(EXTRACTOR_PACK_OUT) build/stats build/testdb -AUTOFORMAT=-qq -i +QL_AUTOFORMAT=-qq -i +GO_AUTOFORMAT=-w # Update files in-place DATAFLOW_BRANCH=master autoformat: - find ql/src -name *.ql -or -name *.qll | xargs codeql query format $(AUTOFORMAT) + find ql/src -name "*.ql" -or -name "*.qll" | xargs codeql query format $(QL_AUTOFORMAT) + git ls-files | grep \\.go$ | xargs grep -L "//\s*autoformat-ignore" | xargs gofmt $(GO_AUTOFORMAT) tools: $(addsuffix $(EXE),$(addprefix tools/bin/,$(BINARIES))) tools/tokenizer.jar diff --git a/ql/test/consistency/test.go b/ql/test/consistency/test.go index ca40bd0f601..68b7721f3ef 100644 --- a/ql/test/consistency/test.go +++ b/ql/test/consistency/test.go @@ -1,5 +1,7 @@ package main +// autoformat-ignore (gofmt chokes on invalid programs) + // Example file with a syntax error to demonstrate use of "expect frontend errors" directive // codeql test: expect frontend errors diff --git a/ql/test/extractor-tests/go1.13/literals.expected b/ql/test/extractor-tests/go1.13/literals.expected index 6da637c835b..0528f9e6502 100644 --- a/ql/test/extractor-tests/go1.13/literals.expected +++ b/ql/test/extractor-tests/go1.13/literals.expected @@ -1,9 +1,9 @@ -| tst.go:4:7:4:12 | 0b1011 | 11 | 11 | -| tst.go:5:7:5:12 | 0B1011 | 11 | 11 | -| tst.go:6:7:6:11 | 0o660 | 432 | 432 | -| tst.go:7:7:7:11 | 0O660 | 432 | 432 | -| tst.go:8:7:8:16 | 0x1.p-1021 | 0x1.p-1021 | 1/22471164185778948846616314884862809170224712236778832159178760144716584475687620391588559665300942002640014234983924169707348721101802077811605928829934265547220986678108185659537777450155761764931635369010625721104768835292807860184239138817603404645418813835573287279993405742309964538104419541203028017152 | -| tst.go:9:7:9:16 | 0X1.p-1021 | 0X1.p-1021 | 1/22471164185778948846616314884862809170224712236778832159178760144716584475687620391588559665300942002640014234983924169707348721101802077811605928829934265547220986678108185659537777450155761764931635369010625721104768835292807860184239138817603404645418813835573287279993405742309964538104419541203028017152 | -| tst.go:10:7:10:15 | 1_000_000 | 1000000 | 1000000 | -| tst.go:11:7:11:18 | 0b_0101_0110 | 86 | 86 | -| tst.go:12:7:12:17 | 3.1415_9265 | 3.1415_9265 | 62831853/20000000 | +| tst.go:6:7:6:12 | 0b1011 | 11 | 11 | +| tst.go:7:7:7:12 | 0B1011 | 11 | 11 | +| tst.go:8:7:8:11 | 0o660 | 432 | 432 | +| tst.go:9:7:9:11 | 0O660 | 432 | 432 | +| tst.go:10:7:10:16 | 0x1.p-1021 | 0x1.p-1021 | 1/22471164185778948846616314884862809170224712236778832159178760144716584475687620391588559665300942002640014234983924169707348721101802077811605928829934265547220986678108185659537777450155761764931635369010625721104768835292807860184239138817603404645418813835573287279993405742309964538104419541203028017152 | +| tst.go:11:7:11:16 | 0X1.p-1021 | 0X1.p-1021 | 1/22471164185778948846616314884862809170224712236778832159178760144716584475687620391588559665300942002640014234983924169707348721101802077811605928829934265547220986678108185659537777450155761764931635369010625721104768835292807860184239138817603404645418813835573287279993405742309964538104419541203028017152 | +| tst.go:12:7:12:15 | 1_000_000 | 1000000 | 1000000 | +| tst.go:13:7:13:18 | 0b_0101_0110 | 86 | 86 | +| tst.go:14:7:14:17 | 3.1415_9265 | 3.1415_9265 | 62831853/20000000 | diff --git a/ql/test/extractor-tests/go1.13/tst.go b/ql/test/extractor-tests/go1.13/tst.go index b5d56088f2e..8a6646f4a09 100644 --- a/ql/test/extractor-tests/go1.13/tst.go +++ b/ql/test/extractor-tests/go1.13/tst.go @@ -1,5 +1,7 @@ package main +// autoformat-ignore (we intentionally test unusual capitalisations of 0B, 0O and other such prefixes) + const ( b1 = 0b1011 b2 = 0B1011 diff --git a/ql/test/extractor-tests/robustness/tst.go b/ql/test/extractor-tests/robustness/tst.go index f78985faade..e5d8097fae4 100644 --- a/ql/test/extractor-tests/robustness/tst.go +++ b/ql/test/extractor-tests/robustness/tst.go @@ -3,5 +3,7 @@ package main // This file tests that the extractor does not crash on files that do not // end in a newline, so it is important not to autoformat this file. +// autoformat-ignore + func main() { } \ No newline at end of file diff --git a/ql/test/library-tests/semmle/go/Expr/BasicLit_getText.expected b/ql/test/library-tests/semmle/go/Expr/BasicLit_getText.expected index b4edc9fb24c..5b43d3987d9 100644 --- a/ql/test/library-tests/semmle/go/Expr/BasicLit_getText.expected +++ b/ql/test/library-tests/semmle/go/Expr/BasicLit_getText.expected @@ -27,48 +27,48 @@ | consts.go:47:16:47:18 | 1.0 | 1.0 | | consts.go:48:16:48:19 | "hi" | "hi" | | literals.go:3:8:3:12 | "fmt" | "fmt" | -| literals.go:6:2:6:10 | "decimal" | "decimal" | -| literals.go:6:17:6:18 | 42 | 42 | -| literals.go:7:2:7:8 | "octal" | "octal" | -| literals.go:7:17:7:20 | 0600 | 0600 | -| literals.go:8:2:8:14 | "hexadecimal" | "hexadecimal" | -| literals.go:8:17:8:24 | 0xcaffee | 0xcaffee | -| literals.go:12:2:12:3 | 0. | 0. | -| literals.go:13:2:13:6 | 72.40 | 72.40 | -| literals.go:14:2:14:7 | 072.40 | 072.40 | -| literals.go:15:2:15:8 | 2.71828 | 2.71828 | -| literals.go:16:2:16:6 | 1.e+0 | 1.e+0 | -| literals.go:17:2:17:12 | 6.67428e-11 | 6.67428e-11 | -| literals.go:18:2:18:4 | 1E6 | 1E6 | -| literals.go:19:2:19:4 | .25 | .25 | -| literals.go:20:2:20:10 | .12345E+5 | .12345E+5 | -| literals.go:24:2:24:3 | 0i | 0i | -| literals.go:25:2:25:5 | 011i | 011i | -| literals.go:26:2:26:4 | 0.i | 0.i | -| literals.go:27:2:27:9 | 2.71828i | 2.71828i | -| literals.go:28:2:28:7 | 1.e+0i | 1.e+0i | -| literals.go:29:2:29:13 | 6.67428e-11i | 6.67428e-11i | -| literals.go:30:2:30:5 | 1E6i | 1E6i | -| literals.go:31:2:31:5 | .25i | .25i | -| literals.go:32:2:32:11 | .12345E+5i | .12345E+5i | -| literals.go:36:2:36:4 | 'a' | 'a' | -| literals.go:37:2:37:5 | '\u00e4' | '\u00e4' | -| literals.go:38:2:38:6 | '\u672c' | '\u672c' | -| literals.go:39:2:39:5 | '\\t' | '\\t' | -| literals.go:40:2:40:7 | '\\007' | '\\007' | -| literals.go:41:2:41:7 | '\\377' | '\\377' | -| literals.go:42:2:42:7 | '\\x07' | '\\x07' | -| literals.go:43:2:43:7 | '\\xff' | '\\xff' | -| literals.go:44:2:44:9 | '\\u12e4' | '\\u12e4' | -| literals.go:45:2:45:13 | '\\U00101234' | '\\U00101234' | -| literals.go:46:2:46:5 | '\\'' | '\\'' | -| literals.go:50:2:50:6 | `abc` | `abc` | -| literals.go:51:2:52:3 | `\\n,\n\\n` | `\\n,\n\\n` | -| literals.go:53:2:53:5 | "\\n" | "\\n" | -| literals.go:54:2:54:5 | "\\"" | "\\"" | -| literals.go:55:2:55:18 | "Hello, world!\\n" | "Hello, world!\\n" | -| literals.go:56:2:56:12 | "\u65e5\u672c\u8a9e" | "\u65e5\u672c\u8a9e" | -| literals.go:57:2:57:22 | "\\u65e5\u672c\\U00008a9e" | "\\u65e5\u672c\\U00008a9e" | -| literals.go:58:2:58:13 | "\\xff\\u00FF" | "\\xff\\u00FF" | -| literals.go:67:22:67:27 | "\ud83d\udcff" | "\ud83d\udcff" | -| literals.go:67:31:67:32 | "" | "" | +| literals.go:8:2:8:10 | "decimal" | "decimal" | +| literals.go:8:17:8:18 | 42 | 42 | +| literals.go:9:2:9:8 | "octal" | "octal" | +| literals.go:9:17:9:20 | 0600 | 0600 | +| literals.go:10:2:10:14 | "hexadecimal" | "hexadecimal" | +| literals.go:10:17:10:24 | 0xcaffee | 0xcaffee | +| literals.go:14:2:14:3 | 0. | 0. | +| literals.go:15:2:15:6 | 72.40 | 72.40 | +| literals.go:16:2:16:7 | 072.40 | 072.40 | +| literals.go:17:2:17:8 | 2.71828 | 2.71828 | +| literals.go:18:2:18:6 | 1.e+0 | 1.e+0 | +| literals.go:19:2:19:12 | 6.67428e-11 | 6.67428e-11 | +| literals.go:20:2:20:4 | 1E6 | 1E6 | +| literals.go:21:2:21:4 | .25 | .25 | +| literals.go:22:2:22:10 | .12345E+5 | .12345E+5 | +| literals.go:26:2:26:3 | 0i | 0i | +| literals.go:27:2:27:5 | 011i | 011i | +| literals.go:28:2:28:4 | 0.i | 0.i | +| literals.go:29:2:29:9 | 2.71828i | 2.71828i | +| literals.go:30:2:30:7 | 1.e+0i | 1.e+0i | +| literals.go:31:2:31:13 | 6.67428e-11i | 6.67428e-11i | +| literals.go:32:2:32:5 | 1E6i | 1E6i | +| literals.go:33:2:33:5 | .25i | .25i | +| literals.go:34:2:34:11 | .12345E+5i | .12345E+5i | +| literals.go:38:2:38:4 | 'a' | 'a' | +| literals.go:39:2:39:5 | '\u00e4' | '\u00e4' | +| literals.go:40:2:40:6 | '\u672c' | '\u672c' | +| literals.go:41:2:41:5 | '\\t' | '\\t' | +| literals.go:42:2:42:7 | '\\007' | '\\007' | +| literals.go:43:2:43:7 | '\\377' | '\\377' | +| literals.go:44:2:44:7 | '\\x07' | '\\x07' | +| literals.go:45:2:45:7 | '\\xff' | '\\xff' | +| literals.go:46:2:46:9 | '\\u12e4' | '\\u12e4' | +| literals.go:47:2:47:13 | '\\U00101234' | '\\U00101234' | +| literals.go:48:2:48:5 | '\\'' | '\\'' | +| literals.go:52:2:52:6 | `abc` | `abc` | +| literals.go:53:2:54:3 | `\\n,\n\\n` | `\\n,\n\\n` | +| literals.go:55:2:55:5 | "\\n" | "\\n" | +| literals.go:56:2:56:5 | "\\"" | "\\"" | +| literals.go:57:2:57:18 | "Hello, world!\\n" | "Hello, world!\\n" | +| literals.go:58:2:58:12 | "\u65e5\u672c\u8a9e" | "\u65e5\u672c\u8a9e" | +| literals.go:59:2:59:22 | "\\u65e5\u672c\\U00008a9e" | "\\u65e5\u672c\\U00008a9e" | +| literals.go:60:2:60:13 | "\\xff\\u00FF" | "\\xff\\u00FF" | +| literals.go:69:22:69:27 | "\ud83d\udcff" | "\ud83d\udcff" | +| literals.go:69:31:69:32 | "" | "" | diff --git a/ql/test/library-tests/semmle/go/Expr/BasicLit_getValue.expected b/ql/test/library-tests/semmle/go/Expr/BasicLit_getValue.expected index 2dfd765d2ee..5fae748da20 100644 --- a/ql/test/library-tests/semmle/go/Expr/BasicLit_getValue.expected +++ b/ql/test/library-tests/semmle/go/Expr/BasicLit_getValue.expected @@ -27,48 +27,48 @@ | consts.go:47:16:47:18 | 1.0 | 1.0 | | consts.go:48:16:48:19 | "hi" | hi | | literals.go:3:8:3:12 | "fmt" | fmt | -| literals.go:6:2:6:10 | "decimal" | decimal | -| literals.go:6:17:6:18 | 42 | 42 | -| literals.go:7:2:7:8 | "octal" | octal | -| literals.go:7:17:7:20 | 0600 | 384 | -| literals.go:8:2:8:14 | "hexadecimal" | hexadecimal | -| literals.go:8:17:8:24 | 0xcaffee | 13303790 | -| literals.go:12:2:12:3 | 0. | 0. | -| literals.go:13:2:13:6 | 72.40 | 72.40 | -| literals.go:14:2:14:7 | 072.40 | 072.40 | -| literals.go:15:2:15:8 | 2.71828 | 2.71828 | -| literals.go:16:2:16:6 | 1.e+0 | 1.e+0 | -| literals.go:17:2:17:12 | 6.67428e-11 | 6.67428e-11 | -| literals.go:18:2:18:4 | 1E6 | 1E6 | -| literals.go:19:2:19:4 | .25 | .25 | -| literals.go:20:2:20:10 | .12345E+5 | .12345E+5 | -| literals.go:24:2:24:3 | 0i | 0i | -| literals.go:25:2:25:5 | 011i | 011i | -| literals.go:26:2:26:4 | 0.i | 0.i | -| literals.go:27:2:27:9 | 2.71828i | 2.71828i | -| literals.go:28:2:28:7 | 1.e+0i | 1.e+0i | -| literals.go:29:2:29:13 | 6.67428e-11i | 6.67428e-11i | -| literals.go:30:2:30:5 | 1E6i | 1E6i | -| literals.go:31:2:31:5 | .25i | .25i | -| literals.go:32:2:32:11 | .12345E+5i | .12345E+5i | -| literals.go:36:2:36:4 | 'a' | a | -| literals.go:37:2:37:5 | '\u00e4' | \u00e4 | -| literals.go:38:2:38:6 | '\u672c' | \u672c | -| literals.go:39:2:39:5 | '\\t' | \t | -| literals.go:40:2:40:7 | '\\007' | \u0007 | -| literals.go:41:2:41:7 | '\\377' | \ufffd | -| literals.go:42:2:42:7 | '\\x07' | \u0007 | -| literals.go:43:2:43:7 | '\\xff' | \ufffd | -| literals.go:44:2:44:9 | '\\u12e4' | \u12e4 | -| literals.go:45:2:45:13 | '\\U00101234' | \udbc4\ude34 | -| literals.go:46:2:46:5 | '\\'' | ' | -| literals.go:50:2:50:6 | `abc` | abc | -| literals.go:51:2:52:3 | `\\n,\n\\n` | \\n,\n\\n | -| literals.go:53:2:53:5 | "\\n" | \n | -| literals.go:54:2:54:5 | "\\"" | " | -| literals.go:55:2:55:18 | "Hello, world!\\n" | Hello, world!\n | -| literals.go:56:2:56:12 | "\u65e5\u672c\u8a9e" | \u65e5\u672c\u8a9e | -| literals.go:57:2:57:22 | "\\u65e5\u672c\\U00008a9e" | \u65e5\u672c\u8a9e | -| literals.go:58:2:58:13 | "\\xff\\u00FF" | \ufffd\u00ff | -| literals.go:67:22:67:27 | "\ud83d\udcff" | \ud83d\udcff | -| literals.go:67:31:67:32 | "" | | +| literals.go:8:2:8:10 | "decimal" | decimal | +| literals.go:8:17:8:18 | 42 | 42 | +| literals.go:9:2:9:8 | "octal" | octal | +| literals.go:9:17:9:20 | 0600 | 384 | +| literals.go:10:2:10:14 | "hexadecimal" | hexadecimal | +| literals.go:10:17:10:24 | 0xcaffee | 13303790 | +| literals.go:14:2:14:3 | 0. | 0. | +| literals.go:15:2:15:6 | 72.40 | 72.40 | +| literals.go:16:2:16:7 | 072.40 | 072.40 | +| literals.go:17:2:17:8 | 2.71828 | 2.71828 | +| literals.go:18:2:18:6 | 1.e+0 | 1.e+0 | +| literals.go:19:2:19:12 | 6.67428e-11 | 6.67428e-11 | +| literals.go:20:2:20:4 | 1E6 | 1E6 | +| literals.go:21:2:21:4 | .25 | .25 | +| literals.go:22:2:22:10 | .12345E+5 | .12345E+5 | +| literals.go:26:2:26:3 | 0i | 0i | +| literals.go:27:2:27:5 | 011i | 011i | +| literals.go:28:2:28:4 | 0.i | 0.i | +| literals.go:29:2:29:9 | 2.71828i | 2.71828i | +| literals.go:30:2:30:7 | 1.e+0i | 1.e+0i | +| literals.go:31:2:31:13 | 6.67428e-11i | 6.67428e-11i | +| literals.go:32:2:32:5 | 1E6i | 1E6i | +| literals.go:33:2:33:5 | .25i | .25i | +| literals.go:34:2:34:11 | .12345E+5i | .12345E+5i | +| literals.go:38:2:38:4 | 'a' | a | +| literals.go:39:2:39:5 | '\u00e4' | \u00e4 | +| literals.go:40:2:40:6 | '\u672c' | \u672c | +| literals.go:41:2:41:5 | '\\t' | \t | +| literals.go:42:2:42:7 | '\\007' | \u0007 | +| literals.go:43:2:43:7 | '\\377' | \ufffd | +| literals.go:44:2:44:7 | '\\x07' | \u0007 | +| literals.go:45:2:45:7 | '\\xff' | \ufffd | +| literals.go:46:2:46:9 | '\\u12e4' | \u12e4 | +| literals.go:47:2:47:13 | '\\U00101234' | \udbc4\ude34 | +| literals.go:48:2:48:5 | '\\'' | ' | +| literals.go:52:2:52:6 | `abc` | abc | +| literals.go:53:2:54:3 | `\\n,\n\\n` | \\n,\n\\n | +| literals.go:55:2:55:5 | "\\n" | \n | +| literals.go:56:2:56:5 | "\\"" | " | +| literals.go:57:2:57:18 | "Hello, world!\\n" | Hello, world!\n | +| literals.go:58:2:58:12 | "\u65e5\u672c\u8a9e" | \u65e5\u672c\u8a9e | +| literals.go:59:2:59:22 | "\\u65e5\u672c\\U00008a9e" | \u65e5\u672c\u8a9e | +| literals.go:60:2:60:13 | "\\xff\\u00FF" | \ufffd\u00ff | +| literals.go:69:22:69:27 | "\ud83d\udcff" | \ud83d\udcff | +| literals.go:69:31:69:32 | "" | | diff --git a/ql/test/library-tests/semmle/go/Expr/CompositeLit.expected b/ql/test/library-tests/semmle/go/Expr/CompositeLit.expected index 8c2e362add3..72903600e4f 100644 --- a/ql/test/library-tests/semmle/go/Expr/CompositeLit.expected +++ b/ql/test/library-tests/semmle/go/Expr/CompositeLit.expected @@ -1,43 +1,43 @@ -| literals.go:5:15:9:1 | map literal | 0 | key | literals.go:6:2:6:10 | "decimal" | -| literals.go:5:15:9:1 | map literal | 0 | value | literals.go:6:17:6:18 | 42 | -| literals.go:5:15:9:1 | map literal | 1 | key | literals.go:7:2:7:8 | "octal" | -| literals.go:5:15:9:1 | map literal | 1 | value | literals.go:7:17:7:20 | 0600 | -| literals.go:5:15:9:1 | map literal | 2 | key | literals.go:8:2:8:14 | "hexadecimal" | -| literals.go:5:15:9:1 | map literal | 2 | value | literals.go:8:17:8:24 | 0xcaffee | -| literals.go:11:17:21:1 | slice literal | 0 | value | literals.go:12:2:12:3 | 0. | -| literals.go:11:17:21:1 | slice literal | 1 | value | literals.go:13:2:13:6 | 72.40 | -| literals.go:11:17:21:1 | slice literal | 2 | value | literals.go:14:2:14:7 | 072.40 | -| literals.go:11:17:21:1 | slice literal | 3 | value | literals.go:15:2:15:8 | 2.71828 | -| literals.go:11:17:21:1 | slice literal | 4 | value | literals.go:16:2:16:6 | 1.e+0 | -| literals.go:11:17:21:1 | slice literal | 5 | value | literals.go:17:2:17:12 | 6.67428e-11 | -| literals.go:11:17:21:1 | slice literal | 6 | value | literals.go:18:2:18:4 | 1E6 | -| literals.go:11:17:21:1 | slice literal | 7 | value | literals.go:19:2:19:4 | .25 | -| literals.go:11:17:21:1 | slice literal | 8 | value | literals.go:20:2:20:10 | .12345E+5 | -| literals.go:23:16:33:1 | slice literal | 0 | value | literals.go:24:2:24:3 | 0i | -| literals.go:23:16:33:1 | slice literal | 1 | value | literals.go:25:2:25:5 | 011i | -| literals.go:23:16:33:1 | slice literal | 2 | value | literals.go:26:2:26:4 | 0.i | -| literals.go:23:16:33:1 | slice literal | 3 | value | literals.go:27:2:27:9 | 2.71828i | -| literals.go:23:16:33:1 | slice literal | 4 | value | literals.go:28:2:28:7 | 1.e+0i | -| literals.go:23:16:33:1 | slice literal | 5 | value | literals.go:29:2:29:13 | 6.67428e-11i | -| literals.go:23:16:33:1 | slice literal | 6 | value | literals.go:30:2:30:5 | 1E6i | -| literals.go:23:16:33:1 | slice literal | 7 | value | literals.go:31:2:31:5 | .25i | -| literals.go:23:16:33:1 | slice literal | 8 | value | literals.go:32:2:32:11 | .12345E+5i | -| literals.go:35:16:47:1 | slice literal | 0 | value | literals.go:36:2:36:4 | 'a' | -| literals.go:35:16:47:1 | slice literal | 1 | value | literals.go:37:2:37:5 | '\u00e4' | -| literals.go:35:16:47:1 | slice literal | 2 | value | literals.go:38:2:38:6 | '\u672c' | -| literals.go:35:16:47:1 | slice literal | 3 | value | literals.go:39:2:39:5 | '\\t' | -| literals.go:35:16:47:1 | slice literal | 4 | value | literals.go:40:2:40:7 | '\\007' | -| literals.go:35:16:47:1 | slice literal | 5 | value | literals.go:41:2:41:7 | '\\377' | -| literals.go:35:16:47:1 | slice literal | 6 | value | literals.go:42:2:42:7 | '\\x07' | -| literals.go:35:16:47:1 | slice literal | 7 | value | literals.go:43:2:43:7 | '\\xff' | -| literals.go:35:16:47:1 | slice literal | 8 | value | literals.go:44:2:44:9 | '\\u12e4' | -| literals.go:35:16:47:1 | slice literal | 9 | value | literals.go:45:2:45:13 | '\\U00101234' | -| literals.go:35:16:47:1 | slice literal | 10 | value | literals.go:46:2:46:5 | '\\'' | -| literals.go:49:15:59:1 | slice literal | 0 | value | literals.go:50:2:50:6 | `abc` | -| literals.go:49:15:59:1 | slice literal | 1 | value | literals.go:51:2:52:3 | `\\n,\n\\n` | -| literals.go:49:15:59:1 | slice literal | 2 | value | literals.go:53:2:53:5 | "\\n" | -| literals.go:49:15:59:1 | slice literal | 3 | value | literals.go:54:2:54:5 | "\\"" | -| literals.go:49:15:59:1 | slice literal | 4 | value | literals.go:55:2:55:18 | "Hello, world!\\n" | -| literals.go:49:15:59:1 | slice literal | 5 | value | literals.go:56:2:56:12 | "\u65e5\u672c\u8a9e" | -| literals.go:49:15:59:1 | slice literal | 6 | value | literals.go:57:2:57:22 | "\\u65e5\u672c\\U00008a9e" | -| literals.go:49:15:59:1 | slice literal | 7 | value | literals.go:58:2:58:13 | "\\xff\\u00FF" | +| literals.go:7:15:11:1 | map literal | 0 | key | literals.go:8:2:8:10 | "decimal" | +| literals.go:7:15:11:1 | map literal | 0 | value | literals.go:8:17:8:18 | 42 | +| literals.go:7:15:11:1 | map literal | 1 | key | literals.go:9:2:9:8 | "octal" | +| literals.go:7:15:11:1 | map literal | 1 | value | literals.go:9:17:9:20 | 0600 | +| literals.go:7:15:11:1 | map literal | 2 | key | literals.go:10:2:10:14 | "hexadecimal" | +| literals.go:7:15:11:1 | map literal | 2 | value | literals.go:10:17:10:24 | 0xcaffee | +| literals.go:13:17:23:1 | slice literal | 0 | value | literals.go:14:2:14:3 | 0. | +| literals.go:13:17:23:1 | slice literal | 1 | value | literals.go:15:2:15:6 | 72.40 | +| literals.go:13:17:23:1 | slice literal | 2 | value | literals.go:16:2:16:7 | 072.40 | +| literals.go:13:17:23:1 | slice literal | 3 | value | literals.go:17:2:17:8 | 2.71828 | +| literals.go:13:17:23:1 | slice literal | 4 | value | literals.go:18:2:18:6 | 1.e+0 | +| literals.go:13:17:23:1 | slice literal | 5 | value | literals.go:19:2:19:12 | 6.67428e-11 | +| literals.go:13:17:23:1 | slice literal | 6 | value | literals.go:20:2:20:4 | 1E6 | +| literals.go:13:17:23:1 | slice literal | 7 | value | literals.go:21:2:21:4 | .25 | +| literals.go:13:17:23:1 | slice literal | 8 | value | literals.go:22:2:22:10 | .12345E+5 | +| literals.go:25:16:35:1 | slice literal | 0 | value | literals.go:26:2:26:3 | 0i | +| literals.go:25:16:35:1 | slice literal | 1 | value | literals.go:27:2:27:5 | 011i | +| literals.go:25:16:35:1 | slice literal | 2 | value | literals.go:28:2:28:4 | 0.i | +| literals.go:25:16:35:1 | slice literal | 3 | value | literals.go:29:2:29:9 | 2.71828i | +| literals.go:25:16:35:1 | slice literal | 4 | value | literals.go:30:2:30:7 | 1.e+0i | +| literals.go:25:16:35:1 | slice literal | 5 | value | literals.go:31:2:31:13 | 6.67428e-11i | +| literals.go:25:16:35:1 | slice literal | 6 | value | literals.go:32:2:32:5 | 1E6i | +| literals.go:25:16:35:1 | slice literal | 7 | value | literals.go:33:2:33:5 | .25i | +| literals.go:25:16:35:1 | slice literal | 8 | value | literals.go:34:2:34:11 | .12345E+5i | +| literals.go:37:16:49:1 | slice literal | 0 | value | literals.go:38:2:38:4 | 'a' | +| literals.go:37:16:49:1 | slice literal | 1 | value | literals.go:39:2:39:5 | '\u00e4' | +| literals.go:37:16:49:1 | slice literal | 2 | value | literals.go:40:2:40:6 | '\u672c' | +| literals.go:37:16:49:1 | slice literal | 3 | value | literals.go:41:2:41:5 | '\\t' | +| literals.go:37:16:49:1 | slice literal | 4 | value | literals.go:42:2:42:7 | '\\007' | +| literals.go:37:16:49:1 | slice literal | 5 | value | literals.go:43:2:43:7 | '\\377' | +| literals.go:37:16:49:1 | slice literal | 6 | value | literals.go:44:2:44:7 | '\\x07' | +| literals.go:37:16:49:1 | slice literal | 7 | value | literals.go:45:2:45:7 | '\\xff' | +| literals.go:37:16:49:1 | slice literal | 8 | value | literals.go:46:2:46:9 | '\\u12e4' | +| literals.go:37:16:49:1 | slice literal | 9 | value | literals.go:47:2:47:13 | '\\U00101234' | +| literals.go:37:16:49:1 | slice literal | 10 | value | literals.go:48:2:48:5 | '\\'' | +| literals.go:51:15:61:1 | slice literal | 0 | value | literals.go:52:2:52:6 | `abc` | +| literals.go:51:15:61:1 | slice literal | 1 | value | literals.go:53:2:54:3 | `\\n,\n\\n` | +| literals.go:51:15:61:1 | slice literal | 2 | value | literals.go:55:2:55:5 | "\\n" | +| literals.go:51:15:61:1 | slice literal | 3 | value | literals.go:56:2:56:5 | "\\"" | +| literals.go:51:15:61:1 | slice literal | 4 | value | literals.go:57:2:57:18 | "Hello, world!\\n" | +| literals.go:51:15:61:1 | slice literal | 5 | value | literals.go:58:2:58:12 | "\u65e5\u672c\u8a9e" | +| literals.go:51:15:61:1 | slice literal | 6 | value | literals.go:59:2:59:22 | "\\u65e5\u672c\\U00008a9e" | +| literals.go:51:15:61:1 | slice literal | 7 | value | literals.go:60:2:60:13 | "\\xff\\u00FF" | diff --git a/ql/test/library-tests/semmle/go/Expr/Ident.expected b/ql/test/library-tests/semmle/go/Expr/Ident.expected index d0b8634aacd..a34325cb740 100644 --- a/ql/test/library-tests/semmle/go/Expr/Ident.expected +++ b/ql/test/library-tests/semmle/go/Expr/Ident.expected @@ -59,22 +59,22 @@ | consts.go:48:2:48:2 | m | | consts.go:48:4:48:11 | mystring | | literals.go:1:9:1:12 | main | -| literals.go:5:5:5:11 | intlits | -| literals.go:5:19:5:24 | string | -| literals.go:5:26:5:28 | int | -| literals.go:11:5:11:13 | floatlits | -| literals.go:11:19:11:25 | float64 | -| literals.go:23:5:23:12 | imaglits | -| literals.go:23:18:23:26 | complex64 | -| literals.go:35:5:35:12 | runelits | -| literals.go:35:18:35:20 | int | -| literals.go:49:5:49:11 | strlits | -| literals.go:49:17:49:22 | string | -| literals.go:61:6:61:13 | literals | -| literals.go:62:6:62:6 | _ | -| literals.go:62:9:62:11 | str | -| literals.go:62:22:62:28 | strlits | -| literals.go:63:3:63:5 | fmt | -| literals.go:63:7:63:13 | Println | -| literals.go:63:15:63:17 | str | -| literals.go:67:5:67:18 | non_bmp_strlit | +| literals.go:7:5:7:11 | intlits | +| literals.go:7:19:7:24 | string | +| literals.go:7:26:7:28 | int | +| literals.go:13:5:13:13 | floatlits | +| literals.go:13:19:13:25 | float64 | +| literals.go:25:5:25:12 | imaglits | +| literals.go:25:18:25:26 | complex64 | +| literals.go:37:5:37:12 | runelits | +| literals.go:37:18:37:20 | int | +| literals.go:51:5:51:11 | strlits | +| literals.go:51:17:51:22 | string | +| literals.go:63:6:63:13 | literals | +| literals.go:64:6:64:6 | _ | +| literals.go:64:9:64:11 | str | +| literals.go:64:22:64:28 | strlits | +| literals.go:65:3:65:5 | fmt | +| literals.go:65:7:65:13 | Println | +| literals.go:65:15:65:17 | str | +| literals.go:69:5:69:18 | non_bmp_strlit | diff --git a/ql/test/library-tests/semmle/go/Expr/literals.go b/ql/test/library-tests/semmle/go/Expr/literals.go index fe9e002ff88..afae8ae88ba 100644 --- a/ql/test/library-tests/semmle/go/Expr/literals.go +++ b/ql/test/library-tests/semmle/go/Expr/literals.go @@ -2,6 +2,8 @@ package main import "fmt" +// autoformat-ignore (we intentionally test unconventional capitalisation of literals like 1E1i) + var intlits = map[string]int{ "decimal": 42, "octal": 0600, diff --git a/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected b/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected index bd1454dbe7f..35e1d303689 100644 --- a/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected +++ b/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected @@ -3,203 +3,177 @@ input.go: # 3| 0: [ImportDecl] import declaration # 3| 0: [ImportSpec] import specifier # 3| 0: [StringLit] "fmt" -# 8| 1: [FuncDecl] function declaration -# 8| 0: [FunctionName, Ident] test5 -# 8| Type = func(bool) -# 8| 1: [FuncTypeExpr] function type -# 8| 0: [ParameterDecl] parameter declaration -# 8| 0: [Ident, TypeName] bool -# 8| Type = bool -# 8| 1: [Ident, VariableName] b -# 8| Type = bool -# 8| 2: [BlockStmt] block statement -# 9| 0: [BlockStmt] block statement -# 10| 0: [IfStmt] if statement -# 10| 0: [NotExpr] !... -# 10| Type = bool -# 10| 0: [Ident, VariableName] b -# 10| Type = bool -# 10| 1: [BlockStmt] block statement -# 11| 0: [GotoStmt] goto statement -# 11| 0: [Ident, LabelName] outer -# 13| 1: [BlockStmt] block statement -# 15| 2: [EmptyStmt] empty statement -# 18| 1: [ExprStmt] expression statement -# 18| 0: [CallExpr] call to Println -# 18| Type = (int, error) -# 18| 0: [FunctionName, SelectorExpr] selection of Println -# 18| Type = func([]interface { }) int, error -# 18| 0: [Ident, PackageName] fmt -# 18| 1: [FunctionName, Ident] Println -# 18| Type = func([]interface { }) int, error -# 18| 1: [StringLit] "Hi" -# 18| Type = string -# 18| Value = [StringLit] Hi -# 20| 2: [LabelledStmt] labeled statement -# 20| 0: [Ident, LabelName] outer -# 21| 1: [ForStmt] for statement -# 21| 0: [ConstantName, Ident] true -# 21| Type = bool literal -# 21| Value = [ConstantName, Ident] true -# 21| 1: [BlockStmt] block statement -# 22| 0: [ForStmt] for statement -# 22| 0: [LssExpr] ...<... -# 22| Type = bool literal -# 22| 0: [Ident, VariableName] i -# 22| Type = int -# 22| 1: [IntLit] 10 -# 22| Type = int -# 22| Value = [IntLit] 10 -# 22| 1: [DefineStmt] ... := ... -# 22| 0: [Ident, VariableName] i -# 22| Type = int -# 22| 1: [IntLit] 0 -# 22| Type = int -# 22| Value = [IntLit] 0 -# 22| 2: [IncStmt] increment statement -# 22| 0: [Ident, VariableName] i -# 22| Type = int -# 22| 3: [BlockStmt] block statement -# 23| 0: [IfStmt] if statement -# 23| 0: [GtrExpr] ...>... -# 23| Type = bool literal -# 23| 0: [Ident, VariableName] j -# 23| Type = int -# 23| 1: [IntLit] 5 -# 23| Type = int -# 23| Value = [IntLit] 5 -# 23| 1: [DefineStmt] ... := ... -# 23| 0: [Ident, VariableName] j -# 23| Type = int -# 23| 1: [SubExpr] ...-... -# 23| Type = int -# 23| 0: [Ident, VariableName] i -# 23| Type = int -# 23| 1: [IntLit] 1 -# 23| Type = int -# 23| Value = [IntLit] 1 -# 23| 2: [BlockStmt] block statement -# 24| 0: [BreakStmt] break statement -# 24| 0: [Ident, LabelName] outer -# 25| 3: [IfStmt] if statement -# 25| 0: [LssExpr] ...<... -# 25| Type = bool literal +# 10| 1: [FuncDecl] function declaration +# 10| 0: [FunctionName, Ident] test5 +# 10| Type = func(bool) +# 10| 1: [FuncTypeExpr] function type +# 10| 0: [ParameterDecl] parameter declaration +# 10| 0: [Ident, TypeName] bool +# 10| Type = bool +# 10| 1: [Ident, VariableName] b +# 10| Type = bool +# 10| 2: [BlockStmt] block statement +# 11| 0: [BlockStmt] block statement +# 12| 0: [IfStmt] if statement +# 12| 0: [NotExpr] !... +# 12| Type = bool +# 12| 0: [Ident, VariableName] b +# 12| Type = bool +# 12| 1: [BlockStmt] block statement +# 13| 0: [GotoStmt] goto statement +# 13| 0: [Ident, LabelName] outer +# 15| 1: [BlockStmt] block statement +# 17| 2: [EmptyStmt] empty statement +# 20| 1: [ExprStmt] expression statement +# 20| 0: [CallExpr] call to Println +# 20| Type = (int, error) +# 20| 0: [FunctionName, SelectorExpr] selection of Println +# 20| Type = func([]interface { }) int, error +# 20| 0: [Ident, PackageName] fmt +# 20| 1: [FunctionName, Ident] Println +# 20| Type = func([]interface { }) int, error +# 20| 1: [StringLit] "Hi" +# 20| Type = string +# 20| Value = [StringLit] Hi +# 22| 2: [LabelledStmt] labeled statement +# 22| 0: [Ident, LabelName] outer +# 23| 1: [ForStmt] for statement +# 23| 0: [ConstantName, Ident] true +# 23| Type = bool literal +# 23| Value = [ConstantName, Ident] true +# 23| 1: [BlockStmt] block statement +# 24| 0: [ForStmt] for statement +# 24| 0: [LssExpr] ...<... +# 24| Type = bool literal +# 24| 0: [Ident, VariableName] i +# 24| Type = int +# 24| 1: [IntLit] 10 +# 24| Type = int +# 24| Value = [IntLit] 10 +# 24| 1: [DefineStmt] ... := ... +# 24| 0: [Ident, VariableName] i +# 24| Type = int +# 24| 1: [IntLit] 0 +# 24| Type = int +# 24| Value = [IntLit] 0 +# 24| 2: [IncStmt] increment statement +# 24| 0: [Ident, VariableName] i +# 24| Type = int +# 24| 3: [BlockStmt] block statement +# 25| 0: [IfStmt] if statement +# 25| 0: [GtrExpr] ...>... +# 25| Type = bool literal +# 25| 0: [Ident, VariableName] j +# 25| Type = int +# 25| 1: [IntLit] 5 +# 25| Type = int +# 25| Value = [IntLit] 5 +# 25| 1: [DefineStmt] ... := ... +# 25| 0: [Ident, VariableName] j +# 25| Type = int +# 25| 1: [SubExpr] ...-... +# 25| Type = int # 25| 0: [Ident, VariableName] i # 25| Type = int -# 25| 1: [IntLit] 3 +# 25| 1: [IntLit] 1 # 25| Type = int -# 25| Value = [IntLit] 3 -# 25| 1: [BlockStmt] block statement -# 26| 0: [BreakStmt] break statement -# 27| 2: [IfStmt] if statement -# 27| 0: [NeqExpr] ...!=... -# 27| Type = bool literal -# 27| 0: [Ident, VariableName] i -# 27| Type = int -# 27| 1: [IntLit] 9 -# 27| Type = int -# 27| Value = [IntLit] 9 -# 27| 1: [BlockStmt] block statement -# 28| 0: [ContinueStmt] continue statement -# 28| 0: [Ident, LabelName] outer -# 29| 2: [IfStmt] if statement -# 29| 0: [GeqExpr] ...>=... -# 29| Type = bool literal -# 29| 0: [Ident, VariableName] i -# 29| Type = int -# 29| 1: [IntLit] 4 -# 29| Type = int -# 29| Value = [IntLit] 4 -# 29| 1: [BlockStmt] block statement -# 30| 0: [GotoStmt] goto statement -# 30| 0: [Ident, LabelName] outer -# 31| 2: [BlockStmt] block statement -# 32| 0: [ContinueStmt] continue statement -# 37| 3: [DefineStmt] ... := ... -# 37| 0: [Ident, VariableName] k -# 37| Type = int -# 37| 1: [IntLit] 9 -# 37| Type = int -# 37| Value = [IntLit] 9 -# 38| 4: [ForStmt] for statement -# 38| 0: [IncStmt] increment statement -# 38| 0: [Ident, VariableName] k -# 38| Type = int -# 38| 1: [BlockStmt] block statement -# 39| 0: [GotoStmt] goto statement -# 39| 0: [Ident, LabelName] outer -# 44| 2: [FuncDecl] function declaration -# 44| 0: [FunctionName, Ident] test6 -# 44| Type = func(chan int, chan float32) -# 44| 1: [FuncTypeExpr] function type -# 44| 0: [ParameterDecl] parameter declaration -# 44| 0: [SendRecvChanTypeExpr] channel type -# 44| Type = chan int -# 44| 0: [Ident, TypeName] int -# 44| Type = int -# 44| 1: [Ident, VariableName] ch1 -# 44| Type = chan int -# 44| 1: [ParameterDecl] parameter declaration -# 44| 0: [SendRecvChanTypeExpr] channel type -# 44| Type = chan float32 -# 44| 0: [Ident, TypeName] float32 -# 44| Type = float32 -# 44| 1: [Ident, VariableName] ch2 -# 44| Type = chan float32 -# 44| 2: [BlockStmt] block statement -# 45| 0: [DeclStmt] declaration statement -# 45| 0: [VarDecl] variable declaration -# 45| 0: [ValueSpec] value declaration specifier -# 45| 0: [Ident, VariableName] a -# 45| Type = [1]float32 -# 45| 1: [ArrayTypeExpr] array type -# 45| Type = [1]float32 -# 45| 0: [IntLit] 1 -# 45| Type = int literal -# 45| Value = [IntLit] 1 -# 45| 1: [Ident, TypeName] float32 -# 45| Type = float32 -# 46| 1: [DeclStmt] declaration statement -# 46| 0: [VarDecl] variable declaration -# 46| 0: [ValueSpec] value declaration specifier -# 46| 0: [Ident, VariableName] w -# 46| Type = bool -# 46| 1: [Ident, TypeName] bool -# 46| Type = bool -# 48| 2: [SelectStmt] select statement -# 48| 0: [BlockStmt] block statement -# 49| 0: [CommClause] comm clause -# 49| 0: [ExprStmt, RecvStmt] expression statement -# 49| 0: [RecvExpr] <-... -# 49| Type = int -# 49| 0: [Ident, VariableName] ch1 -# 49| Type = chan int -# 50| 1: [ExprStmt] expression statement -# 50| 0: [CallExpr] call to Println -# 50| Type = (int, error) -# 50| 0: [FunctionName, SelectorExpr] selection of Println -# 50| Type = func([]interface { }) int, error -# 50| 0: [Ident, PackageName] fmt -# 50| 1: [FunctionName, Ident] Println -# 50| Type = func([]interface { }) int, error -# 50| 1: [StringLit] "Heard from ch1" -# 50| Type = string -# 50| Value = [StringLit] Heard from ch1 -# 51| 1: [CommClause] comm clause -# 51| 0: [AssignStmt, RecvStmt] ... = ... -# 51| 0: [Ident, VariableName] w -# 51| Type = bool -# 51| 1: [IndexExpr] index expression -# 51| Type = float32 -# 51| 0: [Ident, VariableName] a -# 51| Type = [1]float32 -# 51| 1: [IntLit] 0 -# 51| Type = int -# 51| Value = [IntLit] 0 -# 51| 2: [RecvExpr] <-... -# 51| Type = (float32, bool) -# 51| 0: [Ident, VariableName] ch2 -# 51| Type = chan float32 +# 25| Value = [IntLit] 1 +# 25| 2: [BlockStmt] block statement +# 26| 0: [BreakStmt] break statement +# 26| 0: [Ident, LabelName] outer +# 27| 3: [IfStmt] if statement +# 27| 0: [LssExpr] ...<... +# 27| Type = bool literal +# 27| 0: [Ident, VariableName] i +# 27| Type = int +# 27| 1: [IntLit] 3 +# 27| Type = int +# 27| Value = [IntLit] 3 +# 27| 1: [BlockStmt] block statement +# 28| 0: [BreakStmt] break statement +# 29| 2: [IfStmt] if statement +# 29| 0: [NeqExpr] ...!=... +# 29| Type = bool literal +# 29| 0: [Ident, VariableName] i +# 29| Type = int +# 29| 1: [IntLit] 9 +# 29| Type = int +# 29| Value = [IntLit] 9 +# 29| 1: [BlockStmt] block statement +# 30| 0: [ContinueStmt] continue statement +# 30| 0: [Ident, LabelName] outer +# 31| 2: [IfStmt] if statement +# 31| 0: [GeqExpr] ...>=... +# 31| Type = bool literal +# 31| 0: [Ident, VariableName] i +# 31| Type = int +# 31| 1: [IntLit] 4 +# 31| Type = int +# 31| Value = [IntLit] 4 +# 31| 1: [BlockStmt] block statement +# 32| 0: [GotoStmt] goto statement +# 32| 0: [Ident, LabelName] outer +# 33| 2: [BlockStmt] block statement +# 34| 0: [ContinueStmt] continue statement +# 39| 3: [DefineStmt] ... := ... +# 39| 0: [Ident, VariableName] k +# 39| Type = int +# 39| 1: [IntLit] 9 +# 39| Type = int +# 39| Value = [IntLit] 9 +# 40| 4: [ForStmt] for statement +# 40| 0: [IncStmt] increment statement +# 40| 0: [Ident, VariableName] k +# 40| Type = int +# 40| 1: [BlockStmt] block statement +# 41| 0: [GotoStmt] goto statement +# 41| 0: [Ident, LabelName] outer +# 46| 2: [FuncDecl] function declaration +# 46| 0: [FunctionName, Ident] test6 +# 46| Type = func(chan int, chan float32) +# 46| 1: [FuncTypeExpr] function type +# 46| 0: [ParameterDecl] parameter declaration +# 46| 0: [SendRecvChanTypeExpr] channel type +# 46| Type = chan int +# 46| 0: [Ident, TypeName] int +# 46| Type = int +# 46| 1: [Ident, VariableName] ch1 +# 46| Type = chan int +# 46| 1: [ParameterDecl] parameter declaration +# 46| 0: [SendRecvChanTypeExpr] channel type +# 46| Type = chan float32 +# 46| 0: [Ident, TypeName] float32 +# 46| Type = float32 +# 46| 1: [Ident, VariableName] ch2 +# 46| Type = chan float32 +# 46| 2: [BlockStmt] block statement +# 47| 0: [DeclStmt] declaration statement +# 47| 0: [VarDecl] variable declaration +# 47| 0: [ValueSpec] value declaration specifier +# 47| 0: [Ident, VariableName] a +# 47| Type = [1]float32 +# 47| 1: [ArrayTypeExpr] array type +# 47| Type = [1]float32 +# 47| 0: [IntLit] 1 +# 47| Type = int literal +# 47| Value = [IntLit] 1 +# 47| 1: [Ident, TypeName] float32 +# 47| Type = float32 +# 48| 1: [DeclStmt] declaration statement +# 48| 0: [VarDecl] variable declaration +# 48| 0: [ValueSpec] value declaration specifier +# 48| 0: [Ident, VariableName] w +# 48| Type = bool +# 48| 1: [Ident, TypeName] bool +# 48| Type = bool +# 50| 2: [SelectStmt] select statement +# 50| 0: [BlockStmt] block statement +# 51| 0: [CommClause] comm clause +# 51| 0: [ExprStmt, RecvStmt] expression statement +# 51| 0: [RecvExpr] <-... +# 51| Type = int +# 51| 0: [Ident, VariableName] ch1 +# 51| Type = chan int # 52| 1: [ExprStmt] expression statement # 52| 0: [CallExpr] call to Println # 52| Type = (int, error) @@ -208,20 +182,35 @@ input.go: # 52| 0: [Ident, PackageName] fmt # 52| 1: [FunctionName, Ident] Println # 52| Type = func([]interface { }) int, error -# 52| 1: [Ident, VariableName] a -# 52| Type = [1]float32 -# 53| 2: [ExprStmt] expression statement -# 53| 0: [CallExpr] call to Println -# 53| Type = (int, error) -# 53| 0: [FunctionName, SelectorExpr] selection of Println -# 53| Type = func([]interface { }) int, error -# 53| 0: [Ident, PackageName] fmt -# 53| 1: [FunctionName, Ident] Println -# 53| Type = func([]interface { }) int, error -# 53| 1: [Ident, VariableName] w -# 53| Type = bool -# 54| 2: [CommClause] comm clause -# 55| 0: [ExprStmt] expression statement +# 52| 1: [StringLit] "Heard from ch1" +# 52| Type = string +# 52| Value = [StringLit] Heard from ch1 +# 53| 1: [CommClause] comm clause +# 53| 0: [AssignStmt, RecvStmt] ... = ... +# 53| 0: [Ident, VariableName] w +# 53| Type = bool +# 53| 1: [IndexExpr] index expression +# 53| Type = float32 +# 53| 0: [Ident, VariableName] a +# 53| Type = [1]float32 +# 53| 1: [IntLit] 0 +# 53| Type = int +# 53| Value = [IntLit] 0 +# 53| 2: [RecvExpr] <-... +# 53| Type = (float32, bool) +# 53| 0: [Ident, VariableName] ch2 +# 53| Type = chan float32 +# 54| 1: [ExprStmt] expression statement +# 54| 0: [CallExpr] call to Println +# 54| Type = (int, error) +# 54| 0: [FunctionName, SelectorExpr] selection of Println +# 54| Type = func([]interface { }) int, error +# 54| 0: [Ident, PackageName] fmt +# 54| 1: [FunctionName, Ident] Println +# 54| Type = func([]interface { }) int, error +# 54| 1: [Ident, VariableName] a +# 54| Type = [1]float32 +# 55| 2: [ExprStmt] expression statement # 55| 0: [CallExpr] call to Println # 55| Type = (int, error) # 55| 0: [FunctionName, SelectorExpr] selection of Println @@ -229,56 +218,48 @@ input.go: # 55| 0: [Ident, PackageName] fmt # 55| 1: [FunctionName, Ident] Println # 55| Type = func([]interface { }) int, error -# 56| 3: [CommClause] comm clause -# 56| 0: [SendStmt] send statement -# 56| 0: [Ident, VariableName] ch1 -# 56| Type = chan int -# 56| 1: [IntLit] 42 -# 56| Type = int -# 56| Value = [IntLit] 42 -# 59| 3: [SelectStmt] select statement -# 59| 0: [BlockStmt] block statement -# 63| 3: [FuncDecl] function declaration -# 63| 0: [FunctionName, Ident] test7 -# 63| Type = func(int) int -# 63| 1: [FuncTypeExpr] function type -# 63| 0: [ResultVariableDecl] result variable declaration -# 63| 0: [Ident, TypeName] int -# 63| Type = int -# 63| 1: [ParameterDecl] parameter declaration -# 63| 0: [Ident, TypeName] int -# 63| Type = int -# 63| 1: [Ident, VariableName] x -# 63| Type = int -# 63| 2: [BlockStmt] block statement -# 64| 0: [IfStmt] if statement -# 64| 0: [GtrExpr] ...>... -# 64| Type = bool literal -# 64| 0: [Ident, VariableName] x -# 64| Type = int -# 64| 1: [IntLit] 0 -# 64| Type = int -# 64| Value = [IntLit] 0 -# 64| 1: [BlockStmt] block statement -# 65| 0: [DeferStmt] defer statement -# 65| 0: [CallExpr] function call -# 65| Type = () -# 65| 0: [FuncLit] function literal -# 65| Type = func() -# 65| 0: [FuncTypeExpr] function type -# 65| Type = func() -# 65| 1: [BlockStmt] block statement -# 65| 0: [ExprStmt] expression statement -# 65| 0: [CallExpr] call to Println -# 65| Type = (int, error) -# 65| 0: [FunctionName, SelectorExpr] selection of Println -# 65| Type = func([]interface { }) int, error -# 65| 0: [Ident, PackageName] fmt -# 65| 1: [FunctionName, Ident] Println -# 65| Type = func([]interface { }) int, error -# 65| 1: [Ident, VariableName] x -# 65| Type = int -# 66| 2: [BlockStmt] block statement +# 55| 1: [Ident, VariableName] w +# 55| Type = bool +# 56| 2: [CommClause] comm clause +# 57| 0: [ExprStmt] expression statement +# 57| 0: [CallExpr] call to Println +# 57| Type = (int, error) +# 57| 0: [FunctionName, SelectorExpr] selection of Println +# 57| Type = func([]interface { }) int, error +# 57| 0: [Ident, PackageName] fmt +# 57| 1: [FunctionName, Ident] Println +# 57| Type = func([]interface { }) int, error +# 58| 3: [CommClause] comm clause +# 58| 0: [SendStmt] send statement +# 58| 0: [Ident, VariableName] ch1 +# 58| Type = chan int +# 58| 1: [IntLit] 42 +# 58| Type = int +# 58| Value = [IntLit] 42 +# 61| 3: [SelectStmt] select statement +# 61| 0: [BlockStmt] block statement +# 65| 3: [FuncDecl] function declaration +# 65| 0: [FunctionName, Ident] test7 +# 65| Type = func(int) int +# 65| 1: [FuncTypeExpr] function type +# 65| 0: [ResultVariableDecl] result variable declaration +# 65| 0: [Ident, TypeName] int +# 65| Type = int +# 65| 1: [ParameterDecl] parameter declaration +# 65| 0: [Ident, TypeName] int +# 65| Type = int +# 65| 1: [Ident, VariableName] x +# 65| Type = int +# 65| 2: [BlockStmt] block statement +# 66| 0: [IfStmt] if statement +# 66| 0: [GtrExpr] ...>... +# 66| Type = bool literal +# 66| 0: [Ident, VariableName] x +# 66| Type = int +# 66| 1: [IntLit] 0 +# 66| Type = int +# 66| Value = [IntLit] 0 +# 66| 1: [BlockStmt] block statement # 67| 0: [DeferStmt] defer statement # 67| 0: [CallExpr] function call # 67| Type = () @@ -295,298 +276,319 @@ input.go: # 67| 0: [Ident, PackageName] fmt # 67| 1: [FunctionName, Ident] Println # 67| Type = func([]interface { }) int, error -# 67| 1: [MinusExpr] -... +# 67| 1: [Ident, VariableName] x # 67| Type = int -# 67| 0: [Ident, VariableName] x -# 67| Type = int -# 69| 1: [ReturnStmt] return statement -# 69| 0: [IntLit] 42 -# 69| Type = int -# 69| Value = [IntLit] 42 -# 73| 4: [FuncDecl] function declaration -# 73| 0: [FunctionName, Ident] test8 -# 73| Type = func(int) -# 73| 1: [FuncTypeExpr] function type -# 73| 0: [ParameterDecl] parameter declaration -# 73| 0: [Ident, TypeName] int -# 73| Type = int -# 73| 1: [Ident, VariableName] x -# 73| Type = int -# 73| 2: [BlockStmt] block statement -# 74| 0: [ExpressionSwitchStmt] expression-switch statement -# 74| 0: [Ident, VariableName] x -# 74| Type = int -# 74| 1: [BlockStmt] block statement -# 77| 1: [ExpressionSwitchStmt] expression-switch statement -# 77| 0: [SubExpr] ...-... -# 77| Type = int -# 77| 0: [Ident, VariableName] y -# 77| Type = int -# 77| 1: [IntLit] 19 -# 77| Type = int -# 77| Value = [IntLit] 19 -# 77| 1: [DefineStmt] ... := ... -# 77| 0: [Ident, VariableName] y -# 77| Type = int -# 77| 1: [Ident, VariableName] x -# 77| Type = int -# 77| 2: [BlockStmt] block statement -# 78| 0: [CaseClause] case clause -# 79| 0: [ExprStmt] expression statement -# 79| 0: [CallExpr] call to test5 -# 79| Type = () -# 79| 0: [FunctionName, Ident] test5 -# 79| Type = func(bool) -# 79| 1: [ConstantName, Ident] false -# 79| Type = bool -# 79| Value = [ConstantName, Ident] false -# 82| 2: [ExpressionSwitchStmt] expression-switch statement -# 82| 0: [Ident, VariableName] x -# 82| Type = int -# 82| 1: [BlockStmt] block statement -# 83| 0: [CaseClause] case clause -# 83| 0: [IntLit] 1 -# 83| Type = int -# 83| Value = [IntLit] 1 -# 84| 1: [CaseClause] case clause -# 84| 0: [IntLit] 3 -# 84| Type = int -# 84| Value = [IntLit] 3 -# 84| 1: [IntLit] 2 -# 84| Type = int -# 84| Value = [IntLit] 2 -# 85| 2: [ExprStmt] expression statement -# 85| 0: [CallExpr] call to test5 -# 85| Type = () -# 85| 0: [FunctionName, Ident] test5 -# 85| Type = func(bool) -# 85| 1: [ConstantName, Ident] true -# 85| Type = bool -# 85| Value = [ConstantName, Ident] true -# 88| 3: [ExpressionSwitchStmt] expression-switch statement -# 88| 0: [Ident, VariableName] x -# 88| Type = int -# 88| 1: [BlockStmt] block statement -# 89| 0: [CaseClause] case clause -# 89| 0: [IntLit] 1 -# 89| Type = int -# 89| Value = [IntLit] 1 -# 90| 1: [ExprStmt] expression statement -# 90| 0: [CallExpr] call to test5 -# 90| Type = () -# 90| 0: [FunctionName, Ident] test5 -# 90| Type = func(bool) -# 90| 1: [ConstantName, Ident] false -# 90| Type = bool -# 90| Value = [ConstantName, Ident] false -# 91| 2: [FallthroughStmt] fallthrough statement -# 92| 1: [CaseClause] case clause -# 92| 0: [SubExpr] ...-... -# 92| Type = int -# 92| Value = [SubExpr] -3 -# 92| 0: [IntLit] 2 -# 92| Type = int literal -# 92| Value = [IntLit] 2 -# 92| 1: [IntLit] 5 -# 92| Type = int literal -# 92| Value = [IntLit] 5 -# 93| 1: [ExprStmt] expression statement -# 93| 0: [CallExpr] call to test5 -# 93| Type = () -# 93| 0: [FunctionName, Ident] test5 -# 93| Type = func(bool) -# 93| 1: [ConstantName, Ident] true -# 93| Type = bool -# 93| Value = [ConstantName, Ident] true -# 96| 4: [ExpressionSwitchStmt] expression-switch statement -# 96| 0: [Ident, VariableName] x -# 96| Type = int -# 96| 1: [BlockStmt] block statement -# 97| 0: [CaseClause] case clause -# 98| 1: [CaseClause] case clause -# 98| 0: [IntLit] 2 -# 98| Type = int -# 98| Value = [IntLit] 2 -# 99| 1: [ExprStmt] expression statement -# 99| 0: [CallExpr] call to test5 -# 99| Type = () -# 99| 0: [FunctionName, Ident] test5 -# 99| Type = func(bool) -# 99| 1: [ConstantName, Ident] true -# 99| Type = bool -# 99| Value = [ConstantName, Ident] true -# 102| 5: [ExpressionSwitchStmt] expression-switch statement -# 102| 0: [BlockStmt] block statement -# 103| 0: [CaseClause] case clause -# 104| 0: [BreakStmt] break statement -# 105| 1: [CaseClause] case clause -# 105| 0: [ConstantName, Ident] true -# 105| Type = bool -# 105| Value = [ConstantName, Ident] true -# 110| 5: [FuncDecl] function declaration -# 110| 0: [FunctionName, Ident] test9 -# 110| Type = func(interface { }) -# 110| 1: [FuncTypeExpr] function type -# 110| 0: [ParameterDecl] parameter declaration -# 110| 0: [InterfaceTypeExpr] interface type -# 110| Type = interface { } -# 110| 1: [Ident, VariableName] x -# 110| Type = interface { } -# 110| 2: [BlockStmt] block statement -# 111| 0: [TypeSwitchStmt] type-switch statement -# 111| 0: [DefineStmt] ... := ... -# 111| 0: [Ident] y -# 111| 1: [TypeAssertExpr] type assertion -# 111| 0: [Ident, VariableName] x -# 111| Type = interface { } -# 111| 1: [BlockStmt] block statement -# 112| 0: [CaseClause] case clause -# 112| 0: [Ident, TypeName] string -# 112| Type = string -# 112| 1: [Ident, TypeName] error -# 112| Type = error -# 113| 2: [ExprStmt] expression statement -# 113| 0: [CallExpr] call to Println -# 113| Type = (int, error) -# 113| 0: [FunctionName, SelectorExpr] selection of Println -# 113| Type = func([]interface { }) int, error -# 113| 0: [Ident, PackageName] fmt -# 113| 1: [FunctionName, Ident] Println -# 113| Type = func([]interface { }) int, error -# 113| 1: [Ident, VariableName] y -# 113| Type = interface { } -# 114| 1: [CaseClause] case clause -# 114| 0: [Ident, TypeName] float32 -# 114| Type = float32 -# 115| 1: [ExprStmt] expression statement -# 115| 0: [CallExpr] call to test5 -# 115| Type = () -# 115| 0: [FunctionName, Ident] test5 -# 115| Type = func(bool) -# 115| 1: [ConstantName, Ident] true -# 115| Type = bool -# 115| Value = [ConstantName, Ident] true -# 116| 2: [ExprStmt] expression statement -# 116| 0: [CallExpr] call to test5 -# 116| Type = () -# 116| 0: [FunctionName, Ident] test5 -# 116| Type = func(bool) -# 116| 1: [ConstantName, Ident] false -# 116| Type = bool -# 116| Value = [ConstantName, Ident] false -# 119| 1: [TypeSwitchStmt] type-switch statement -# 119| 0: [DefineStmt] ... := ... -# 119| 0: [Ident, VariableName] y -# 119| Type = interface { } -# 119| 1: [Ident, VariableName] x -# 119| Type = interface { } -# 119| 1: [ExprStmt] expression statement -# 119| 0: [TypeAssertExpr] type assertion -# 119| 0: [Ident, VariableName] y -# 119| Type = interface { } -# 119| 2: [BlockStmt] block statement -# 120| 0: [CaseClause] case clause -# 121| 0: [ExprStmt] expression statement -# 121| 0: [CallExpr] call to test5 -# 121| Type = () -# 121| 0: [FunctionName, Ident] test5 -# 121| Type = func(bool) -# 121| 1: [ConstantName, Ident] false -# 121| Type = bool -# 121| Value = [ConstantName, Ident] false -# 126| 6: [FuncDecl] function declaration -# 126| 0: [FunctionName, Ident] test10 -# 126| Type = func(func() ) -# 126| 1: [FuncTypeExpr] function type -# 126| 0: [ParameterDecl] parameter declaration -# 126| 0: [FuncTypeExpr] function type -# 126| Type = func() -# 126| 1: [Ident, VariableName] f -# 126| Type = func() -# 126| 2: [BlockStmt] block statement -# 127| 0: [GoStmt] go statement -# 127| 0: [CallExpr] call to f -# 127| Type = () -# 127| 0: [Ident, VariableName] f -# 127| Type = func() -# 131| 7: [FuncDecl] function declaration -# 131| 0: [FunctionName, Ident] test11 -# 131| Type = func([]int) -# 131| 1: [FuncTypeExpr] function type -# 131| 0: [ParameterDecl] parameter declaration -# 131| 0: [ArrayTypeExpr] array type -# 131| Type = []int -# 131| 0: [Ident, TypeName] int -# 131| Type = int -# 131| 1: [Ident, VariableName] xs -# 131| Type = []int -# 131| 2: [BlockStmt] block statement -# 132| 0: [RangeStmt] range statement -# 132| 0: [Ident, VariableName] x -# 132| Type = int -# 132| 1: [Ident, VariableName] xs -# 132| Type = []int -# 132| 2: [BlockStmt] block statement -# 133| 0: [IfStmt] if statement -# 133| 0: [GtrExpr] ...>... -# 133| Type = bool literal -# 133| 0: [Ident, VariableName] x -# 133| Type = int -# 133| 1: [IntLit] 5 -# 133| Type = int -# 133| Value = [IntLit] 5 -# 133| 1: [BlockStmt] block statement -# 134| 0: [ContinueStmt] continue statement -# 136| 1: [ExprStmt] expression statement -# 136| 0: [CallExpr] call to Print -# 136| Type = (int, error) -# 136| 0: [FunctionName, SelectorExpr] selection of Print -# 136| Type = func([]interface { }) int, error -# 136| 0: [Ident, PackageName] fmt -# 136| 1: [FunctionName, Ident] Print -# 136| Type = func([]interface { }) int, error -# 136| 1: [Ident, VariableName] x -# 136| Type = int -# 139| 1: [RangeStmt] range statement -# 139| 0: [Ident, VariableName] i -# 139| Type = int -# 139| 1: [Ident, VariableName] v -# 139| Type = int -# 139| 2: [Ident, VariableName] xs -# 139| Type = []int -# 139| 3: [BlockStmt] block statement -# 140| 0: [ExprStmt] expression statement -# 140| 0: [CallExpr] call to Print -# 140| Type = (int, error) -# 140| 0: [FunctionName, SelectorExpr] selection of Print -# 140| Type = func([]interface { }) int, error -# 140| 0: [Ident, PackageName] fmt -# 140| 1: [FunctionName, Ident] Print -# 140| Type = func([]interface { }) int, error -# 140| 1: [Ident, VariableName] i -# 140| Type = int -# 140| 2: [Ident, VariableName] v -# 140| Type = int -# 143| 2: [RangeStmt] range statement -# 143| 0: [Ident, VariableName] xs -# 143| Type = []int -# 143| 1: [BlockStmt] block statement +# 68| 2: [BlockStmt] block statement +# 69| 0: [DeferStmt] defer statement +# 69| 0: [CallExpr] function call +# 69| Type = () +# 69| 0: [FuncLit] function literal +# 69| Type = func() +# 69| 0: [FuncTypeExpr] function type +# 69| Type = func() +# 69| 1: [BlockStmt] block statement +# 69| 0: [ExprStmt] expression statement +# 69| 0: [CallExpr] call to Println +# 69| Type = (int, error) +# 69| 0: [FunctionName, SelectorExpr] selection of Println +# 69| Type = func([]interface { }) int, error +# 69| 0: [Ident, PackageName] fmt +# 69| 1: [FunctionName, Ident] Println +# 69| Type = func([]interface { }) int, error +# 69| 1: [MinusExpr] -... +# 69| Type = int +# 69| 0: [Ident, VariableName] x +# 69| Type = int +# 71| 1: [ReturnStmt] return statement +# 71| 0: [IntLit] 42 +# 71| Type = int +# 71| Value = [IntLit] 42 +# 75| 4: [FuncDecl] function declaration +# 75| 0: [FunctionName, Ident] test8 +# 75| Type = func(int) +# 75| 1: [FuncTypeExpr] function type +# 75| 0: [ParameterDecl] parameter declaration +# 75| 0: [Ident, TypeName] int +# 75| Type = int +# 75| 1: [Ident, VariableName] x +# 75| Type = int +# 75| 2: [BlockStmt] block statement +# 76| 0: [ExpressionSwitchStmt] expression-switch statement +# 76| 0: [Ident, VariableName] x +# 76| Type = int +# 76| 1: [BlockStmt] block statement +# 79| 1: [ExpressionSwitchStmt] expression-switch statement +# 79| 0: [SubExpr] ...-... +# 79| Type = int +# 79| 0: [Ident, VariableName] y +# 79| Type = int +# 79| 1: [IntLit] 19 +# 79| Type = int +# 79| Value = [IntLit] 19 +# 79| 1: [DefineStmt] ... := ... +# 79| 0: [Ident, VariableName] y +# 79| Type = int +# 79| 1: [Ident, VariableName] x +# 79| Type = int +# 79| 2: [BlockStmt] block statement +# 80| 0: [CaseClause] case clause +# 81| 0: [ExprStmt] expression statement +# 81| 0: [CallExpr] call to test5 +# 81| Type = () +# 81| 0: [FunctionName, Ident] test5 +# 81| Type = func(bool) +# 81| 1: [ConstantName, Ident] false +# 81| Type = bool +# 81| Value = [ConstantName, Ident] false +# 84| 2: [ExpressionSwitchStmt] expression-switch statement +# 84| 0: [Ident, VariableName] x +# 84| Type = int +# 84| 1: [BlockStmt] block statement +# 85| 0: [CaseClause] case clause +# 85| 0: [IntLit] 1 +# 85| Type = int +# 85| Value = [IntLit] 1 +# 86| 1: [CaseClause] case clause +# 86| 0: [IntLit] 3 +# 86| Type = int +# 86| Value = [IntLit] 3 +# 86| 1: [IntLit] 2 +# 86| Type = int +# 86| Value = [IntLit] 2 +# 87| 2: [ExprStmt] expression statement +# 87| 0: [CallExpr] call to test5 +# 87| Type = () +# 87| 0: [FunctionName, Ident] test5 +# 87| Type = func(bool) +# 87| 1: [ConstantName, Ident] true +# 87| Type = bool +# 87| Value = [ConstantName, Ident] true +# 90| 3: [ExpressionSwitchStmt] expression-switch statement +# 90| 0: [Ident, VariableName] x +# 90| Type = int +# 90| 1: [BlockStmt] block statement +# 91| 0: [CaseClause] case clause +# 91| 0: [IntLit] 1 +# 91| Type = int +# 91| Value = [IntLit] 1 +# 92| 1: [ExprStmt] expression statement +# 92| 0: [CallExpr] call to test5 +# 92| Type = () +# 92| 0: [FunctionName, Ident] test5 +# 92| Type = func(bool) +# 92| 1: [ConstantName, Ident] false +# 92| Type = bool +# 92| Value = [ConstantName, Ident] false +# 93| 2: [FallthroughStmt] fallthrough statement +# 94| 1: [CaseClause] case clause +# 94| 0: [SubExpr] ...-... +# 94| Type = int +# 94| Value = [SubExpr] -3 +# 94| 0: [IntLit] 2 +# 94| Type = int literal +# 94| Value = [IntLit] 2 +# 94| 1: [IntLit] 5 +# 94| Type = int literal +# 94| Value = [IntLit] 5 +# 95| 1: [ExprStmt] expression statement +# 95| 0: [CallExpr] call to test5 +# 95| Type = () +# 95| 0: [FunctionName, Ident] test5 +# 95| Type = func(bool) +# 95| 1: [ConstantName, Ident] true +# 95| Type = bool +# 95| Value = [ConstantName, Ident] true +# 98| 4: [ExpressionSwitchStmt] expression-switch statement +# 98| 0: [Ident, VariableName] x +# 98| Type = int +# 98| 1: [BlockStmt] block statement +# 99| 0: [CaseClause] case clause +# 100| 1: [CaseClause] case clause +# 100| 0: [IntLit] 2 +# 100| Type = int +# 100| Value = [IntLit] 2 +# 101| 1: [ExprStmt] expression statement +# 101| 0: [CallExpr] call to test5 +# 101| Type = () +# 101| 0: [FunctionName, Ident] test5 +# 101| Type = func(bool) +# 101| 1: [ConstantName, Ident] true +# 101| Type = bool +# 101| Value = [ConstantName, Ident] true +# 104| 5: [ExpressionSwitchStmt] expression-switch statement +# 104| 0: [BlockStmt] block statement +# 105| 0: [CaseClause] case clause +# 106| 0: [BreakStmt] break statement +# 107| 1: [CaseClause] case clause +# 107| 0: [ConstantName, Ident] true +# 107| Type = bool +# 107| Value = [ConstantName, Ident] true +# 112| 5: [FuncDecl] function declaration +# 112| 0: [FunctionName, Ident] test9 +# 112| Type = func(interface { }) +# 112| 1: [FuncTypeExpr] function type +# 112| 0: [ParameterDecl] parameter declaration +# 112| 0: [InterfaceTypeExpr] interface type +# 112| Type = interface { } +# 112| 1: [Ident, VariableName] x +# 112| Type = interface { } +# 112| 2: [BlockStmt] block statement +# 113| 0: [TypeSwitchStmt] type-switch statement +# 113| 0: [DefineStmt] ... := ... +# 113| 0: [Ident] y +# 113| 1: [TypeAssertExpr] type assertion +# 113| 0: [Ident, VariableName] x +# 113| Type = interface { } +# 113| 1: [BlockStmt] block statement +# 114| 0: [CaseClause] case clause +# 114| 0: [Ident, TypeName] string +# 114| Type = string +# 114| 1: [Ident, TypeName] error +# 114| Type = error +# 115| 2: [ExprStmt] expression statement +# 115| 0: [CallExpr] call to Println +# 115| Type = (int, error) +# 115| 0: [FunctionName, SelectorExpr] selection of Println +# 115| Type = func([]interface { }) int, error +# 115| 0: [Ident, PackageName] fmt +# 115| 1: [FunctionName, Ident] Println +# 115| Type = func([]interface { }) int, error +# 115| 1: [Ident, VariableName] y +# 115| Type = interface { } +# 116| 1: [CaseClause] case clause +# 116| 0: [Ident, TypeName] float32 +# 116| Type = float32 +# 117| 1: [ExprStmt] expression statement +# 117| 0: [CallExpr] call to test5 +# 117| Type = () +# 117| 0: [FunctionName, Ident] test5 +# 117| Type = func(bool) +# 117| 1: [ConstantName, Ident] true +# 117| Type = bool +# 117| Value = [ConstantName, Ident] true +# 118| 2: [ExprStmt] expression statement +# 118| 0: [CallExpr] call to test5 +# 118| Type = () +# 118| 0: [FunctionName, Ident] test5 +# 118| Type = func(bool) +# 118| 1: [ConstantName, Ident] false +# 118| Type = bool +# 118| Value = [ConstantName, Ident] false +# 121| 1: [TypeSwitchStmt] type-switch statement +# 121| 0: [DefineStmt] ... := ... +# 121| 0: [Ident, VariableName] y +# 121| Type = interface { } +# 121| 1: [Ident, VariableName] x +# 121| Type = interface { } +# 121| 1: [ExprStmt] expression statement +# 121| 0: [TypeAssertExpr] type assertion +# 121| 0: [Ident, VariableName] y +# 121| Type = interface { } +# 121| 2: [BlockStmt] block statement +# 122| 0: [CaseClause] case clause +# 123| 0: [ExprStmt] expression statement +# 123| 0: [CallExpr] call to test5 +# 123| Type = () +# 123| 0: [FunctionName, Ident] test5 +# 123| Type = func(bool) +# 123| 1: [ConstantName, Ident] false +# 123| Type = bool +# 123| Value = [ConstantName, Ident] false +# 128| 6: [FuncDecl] function declaration +# 128| 0: [FunctionName, Ident] test10 +# 128| Type = func(func() ) +# 128| 1: [FuncTypeExpr] function type +# 128| 0: [ParameterDecl] parameter declaration +# 128| 0: [FuncTypeExpr] function type +# 128| Type = func() +# 128| 1: [Ident, VariableName] f +# 128| Type = func() +# 128| 2: [BlockStmt] block statement +# 129| 0: [GoStmt] go statement +# 129| 0: [CallExpr] call to f +# 129| Type = () +# 129| 0: [Ident, VariableName] f +# 129| Type = func() +# 133| 7: [FuncDecl] function declaration +# 133| 0: [FunctionName, Ident] test11 +# 133| Type = func([]int) +# 133| 1: [FuncTypeExpr] function type +# 133| 0: [ParameterDecl] parameter declaration +# 133| 0: [ArrayTypeExpr] array type +# 133| Type = []int +# 133| 0: [Ident, TypeName] int +# 133| Type = int +# 133| 1: [Ident, VariableName] xs +# 133| Type = []int +# 133| 2: [BlockStmt] block statement +# 134| 0: [RangeStmt] range statement +# 134| 0: [Ident, VariableName] x +# 134| Type = int +# 134| 1: [Ident, VariableName] xs +# 134| Type = []int +# 134| 2: [BlockStmt] block statement +# 135| 0: [IfStmt] if statement +# 135| 0: [GtrExpr] ...>... +# 135| Type = bool literal +# 135| 0: [Ident, VariableName] x +# 135| Type = int +# 135| 1: [IntLit] 5 +# 135| Type = int +# 135| Value = [IntLit] 5 +# 135| 1: [BlockStmt] block statement +# 136| 0: [ContinueStmt] continue statement +# 138| 1: [ExprStmt] expression statement +# 138| 0: [CallExpr] call to Print +# 138| Type = (int, error) +# 138| 0: [FunctionName, SelectorExpr] selection of Print +# 138| Type = func([]interface { }) int, error +# 138| 0: [Ident, PackageName] fmt +# 138| 1: [FunctionName, Ident] Print +# 138| Type = func([]interface { }) int, error +# 138| 1: [Ident, VariableName] x +# 138| Type = int +# 141| 1: [RangeStmt] range statement +# 141| 0: [Ident, VariableName] i +# 141| Type = int +# 141| 1: [Ident, VariableName] v +# 141| Type = int +# 141| 2: [Ident, VariableName] xs +# 141| Type = []int +# 141| 3: [BlockStmt] block statement +# 142| 0: [ExprStmt] expression statement +# 142| 0: [CallExpr] call to Print +# 142| Type = (int, error) +# 142| 0: [FunctionName, SelectorExpr] selection of Print +# 142| Type = func([]interface { }) int, error +# 142| 0: [Ident, PackageName] fmt +# 142| 1: [FunctionName, Ident] Print +# 142| Type = func([]interface { }) int, error +# 142| 1: [Ident, VariableName] i +# 142| Type = int +# 142| 2: [Ident, VariableName] v +# 142| Type = int +# 145| 2: [RangeStmt] range statement +# 145| 0: [Ident, VariableName] xs +# 145| Type = []int +# 145| 1: [BlockStmt] block statement # 1| 8: [Ident] main -# 7| [DocComment] comment group -# 43| [DocComment] comment group -# 62| [DocComment] comment group -# 72| [DocComment] comment group -# 109| [DocComment] comment group -# 125| [DocComment] comment group -# 130| [DocComment] comment group +# 9| [DocComment] comment group +# 45| [DocComment] comment group +# 64| [DocComment] comment group +# 74| [DocComment] comment group +# 111| [DocComment] comment group +# 127| [DocComment] comment group +# 132| [DocComment] comment group # 5| [CommentGroup] comment group # 5| [SlashSlashComment] comment +# 7| [CommentGroup] comment group # 7| [SlashSlashComment] comment -# 15| [CommentGroup] comment group -# 15| [SlashSlashComment] comment -# 43| [SlashSlashComment] comment -# 62| [SlashSlashComment] comment -# 72| [SlashSlashComment] comment -# 109| [SlashSlashComment] comment -# 125| [SlashSlashComment] comment -# 130| [SlashSlashComment] comment +# 9| [SlashSlashComment] comment +# 17| [CommentGroup] comment group +# 17| [SlashSlashComment] comment +# 45| [SlashSlashComment] comment +# 64| [SlashSlashComment] comment +# 74| [SlashSlashComment] comment +# 111| [SlashSlashComment] comment +# 127| [SlashSlashComment] comment +# 132| [SlashSlashComment] comment diff --git a/ql/test/library-tests/semmle/go/PrintAst/input.go b/ql/test/library-tests/semmle/go/PrintAst/input.go index f9fddbd5504..9d81188faaf 100644 --- a/ql/test/library-tests/semmle/go/PrintAst/input.go +++ b/ql/test/library-tests/semmle/go/PrintAst/input.go @@ -4,6 +4,8 @@ import "fmt" // NOTE: after auto-formatting this file, make sure to put back the empty statement on line 15 below +// autoformat-ignore (in line with the NOTE above) + // simple statements and for loops func test5(b bool) { { diff --git a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.expected b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.expected index a1bc1d77929..7738aef354a 100644 --- a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.expected +++ b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.expected @@ -933,297 +933,297 @@ | stmts8.go:13:2:13:13 | return statement | stmts8.go:14:1:14:1 | exit | | stmts8.go:13:9:13:13 | false | stmts8.go:13:2:13:13 | return statement | | stmts.go:0:0:0:0 | entry | stmts.go:3:1:3:12 | skip | -| stmts.go:3:1:3:12 | skip | stmts.go:8:6:8:10 | skip | -| stmts.go:8:1:8:1 | entry | stmts.go:8:12:8:12 | argument corresponding to b | -| stmts.go:8:1:41:1 | function declaration | stmts.go:44:6:44:10 | skip | -| stmts.go:8:6:8:10 | skip | stmts.go:8:1:41:1 | function declaration | -| stmts.go:8:12:8:12 | argument corresponding to b | stmts.go:8:12:8:12 | initialization of b | -| stmts.go:8:12:8:12 | initialization of b | stmts.go:10:7:10:7 | b | -| stmts.go:10:6:10:7 | !... | stmts.go:10:7:10:7 | !... is false | -| stmts.go:10:6:10:7 | !... | stmts.go:10:7:10:7 | !... is true | -| stmts.go:10:7:10:7 | !... is false | stmts.go:13:3:14:3 | skip | -| stmts.go:10:7:10:7 | !... is true | stmts.go:11:4:11:13 | skip | -| stmts.go:10:7:10:7 | b | stmts.go:10:6:10:7 | !... | -| stmts.go:11:4:11:13 | skip | stmts.go:21:6:21:9 | true | -| stmts.go:13:3:14:3 | skip | stmts.go:15:3:15:3 | skip | -| stmts.go:15:3:15:3 | skip | stmts.go:18:2:18:12 | selection of Println | -| stmts.go:18:2:18:12 | selection of Println | stmts.go:18:14:18:17 | "Hi" | -| stmts.go:18:2:18:18 | call to Println | stmts.go:21:6:21:9 | true | -| stmts.go:18:2:18:18 | call to Println | stmts.go:41:1:41:1 | exit | -| stmts.go:18:14:18:17 | "Hi" | stmts.go:18:2:18:18 | call to Println | -| stmts.go:21:6:21:9 | true | stmts.go:21:9:21:9 | true is true | -| stmts.go:21:9:21:9 | true is false | stmts.go:37:2:37:2 | skip | -| stmts.go:21:9:21:9 | true is true | stmts.go:22:7:22:7 | skip | -| stmts.go:22:7:22:7 | assignment to i | stmts.go:22:15:22:15 | i | -| stmts.go:22:7:22:7 | skip | stmts.go:22:12:22:12 | 0 | -| stmts.go:22:12:22:12 | 0 | stmts.go:22:7:22:7 | assignment to i | -| stmts.go:22:15:22:15 | i | stmts.go:22:19:22:20 | 10 | -| stmts.go:22:15:22:20 | ...<... | stmts.go:22:20:22:20 | ...<... is false | -| stmts.go:22:15:22:20 | ...<... | stmts.go:22:20:22:20 | ...<... is true | -| stmts.go:22:19:22:20 | 10 | stmts.go:22:15:22:20 | ...<... | -| stmts.go:22:20:22:20 | ...<... is false | stmts.go:21:6:21:9 | true | -| stmts.go:22:20:22:20 | ...<... is true | stmts.go:23:7:23:7 | skip | -| stmts.go:22:23:22:23 | i | stmts.go:22:23:22:25 | 1 | -| stmts.go:22:23:22:25 | 1 | stmts.go:22:23:22:25 | rhs of increment statement | -| stmts.go:22:23:22:25 | increment statement | stmts.go:22:15:22:15 | i | -| stmts.go:22:23:22:25 | rhs of increment statement | stmts.go:22:23:22:25 | increment statement | -| stmts.go:23:7:23:7 | assignment to j | stmts.go:23:19:23:19 | j | -| stmts.go:23:7:23:7 | skip | stmts.go:23:12:23:12 | i | -| stmts.go:23:12:23:12 | i | stmts.go:23:16:23:16 | 1 | -| stmts.go:23:12:23:16 | ...-... | stmts.go:23:7:23:7 | assignment to j | -| stmts.go:23:16:23:16 | 1 | stmts.go:23:12:23:16 | ...-... | -| stmts.go:23:19:23:19 | j | stmts.go:23:23:23:23 | 5 | -| stmts.go:23:19:23:23 | ...>... | stmts.go:23:23:23:23 | ...>... is false | -| stmts.go:23:19:23:23 | ...>... | stmts.go:23:23:23:23 | ...>... is true | -| stmts.go:23:23:23:23 | 5 | stmts.go:23:19:23:23 | ...>... | -| stmts.go:23:23:23:23 | ...>... is false | stmts.go:25:14:25:14 | i | -| stmts.go:23:23:23:23 | ...>... is true | stmts.go:24:5:24:15 | skip | -| stmts.go:24:5:24:15 | skip | stmts.go:37:2:37:2 | skip | -| stmts.go:25:14:25:14 | i | stmts.go:25:18:25:18 | 3 | -| stmts.go:25:14:25:18 | ...<... | stmts.go:25:18:25:18 | ...<... is false | -| stmts.go:25:14:25:18 | ...<... | stmts.go:25:18:25:18 | ...<... is true | -| stmts.go:25:18:25:18 | 3 | stmts.go:25:14:25:18 | ...<... | -| stmts.go:25:18:25:18 | ...<... is false | stmts.go:27:14:27:14 | i | -| stmts.go:25:18:25:18 | ...<... is true | stmts.go:26:5:26:9 | skip | -| stmts.go:26:5:26:9 | skip | stmts.go:21:6:21:9 | true | -| stmts.go:27:14:27:14 | i | stmts.go:27:19:27:19 | 9 | -| stmts.go:27:14:27:19 | ...!=... | stmts.go:27:19:27:19 | ...!=... is false | -| stmts.go:27:14:27:19 | ...!=... | stmts.go:27:19:27:19 | ...!=... is true | -| stmts.go:27:14:27:19 | ...!=... | stmts.go:41:1:41:1 | exit | -| stmts.go:27:19:27:19 | 9 | stmts.go:27:14:27:19 | ...!=... | -| stmts.go:27:19:27:19 | ...!=... is false | stmts.go:29:14:29:14 | i | -| stmts.go:27:19:27:19 | ...!=... is true | stmts.go:28:5:28:18 | skip | -| stmts.go:28:5:28:18 | skip | stmts.go:21:6:21:9 | true | -| stmts.go:29:14:29:14 | i | stmts.go:29:19:29:19 | 4 | -| stmts.go:29:14:29:19 | ...>=... | stmts.go:29:19:29:19 | ...>=... is false | -| stmts.go:29:14:29:19 | ...>=... | stmts.go:29:19:29:19 | ...>=... is true | -| stmts.go:29:19:29:19 | 4 | stmts.go:29:14:29:19 | ...>=... | -| stmts.go:29:19:29:19 | ...>=... is false | stmts.go:32:5:32:12 | skip | -| stmts.go:29:19:29:19 | ...>=... is true | stmts.go:30:5:30:14 | skip | -| stmts.go:30:5:30:14 | skip | stmts.go:21:6:21:9 | true | -| stmts.go:32:5:32:12 | skip | stmts.go:22:23:22:23 | i | -| stmts.go:37:2:37:2 | assignment to k | stmts.go:39:3:39:12 | skip | -| stmts.go:37:2:37:2 | skip | stmts.go:37:7:37:7 | 9 | -| stmts.go:37:7:37:7 | 9 | stmts.go:37:2:37:2 | assignment to k | -| stmts.go:38:10:38:10 | k | stmts.go:38:10:38:12 | 1 | -| stmts.go:38:10:38:12 | 1 | stmts.go:38:10:38:12 | rhs of increment statement | -| stmts.go:38:10:38:12 | increment statement | stmts.go:39:3:39:12 | skip | -| stmts.go:38:10:38:12 | rhs of increment statement | stmts.go:38:10:38:12 | increment statement | -| stmts.go:39:3:39:12 | skip | stmts.go:21:6:21:9 | true | -| stmts.go:44:1:44:1 | entry | stmts.go:44:12:44:14 | argument corresponding to ch1 | -| stmts.go:44:1:60:1 | function declaration | stmts.go:63:6:63:10 | skip | -| stmts.go:44:6:44:10 | skip | stmts.go:44:1:60:1 | function declaration | -| stmts.go:44:12:44:14 | argument corresponding to ch1 | stmts.go:44:12:44:14 | initialization of ch1 | -| stmts.go:44:12:44:14 | initialization of ch1 | stmts.go:44:26:44:28 | argument corresponding to ch2 | -| stmts.go:44:26:44:28 | argument corresponding to ch2 | stmts.go:44:26:44:28 | initialization of ch2 | -| stmts.go:44:26:44:28 | initialization of ch2 | stmts.go:45:6:45:6 | skip | -| stmts.go:45:6:45:6 | assignment to a | stmts.go:46:6:46:6 | skip | -| stmts.go:45:6:45:6 | skip | stmts.go:45:6:45:6 | zero value for a | -| stmts.go:45:6:45:6 | zero value for a | stmts.go:45:6:45:6 | assignment to a | -| stmts.go:46:6:46:6 | assignment to w | stmts.go:49:9:49:11 | ch1 | -| stmts.go:46:6:46:6 | skip | stmts.go:46:6:46:6 | zero value for w | -| stmts.go:46:6:46:6 | zero value for w | stmts.go:46:6:46:6 | assignment to w | -| stmts.go:48:2:57:2 | select statement | stmts.go:49:7:49:11 | <-... | -| stmts.go:48:2:57:2 | select statement | stmts.go:51:17:51:21 | <-... | -| stmts.go:48:2:57:2 | select statement | stmts.go:55:3:55:13 | selection of Println | -| stmts.go:48:2:57:2 | select statement | stmts.go:56:7:56:15 | send statement | -| stmts.go:49:7:49:11 | <-... | stmts.go:50:3:50:13 | selection of Println | -| stmts.go:49:9:49:11 | ch1 | stmts.go:51:19:51:21 | ch2 | -| stmts.go:50:3:50:13 | selection of Println | stmts.go:50:15:50:30 | "Heard from ch1" | -| stmts.go:50:3:50:31 | call to Println | stmts.go:59:2:59:10 | select statement | -| stmts.go:50:3:50:31 | call to Println | stmts.go:60:1:60:1 | exit | -| stmts.go:50:15:50:30 | "Heard from ch1" | stmts.go:50:3:50:31 | call to Println | -| stmts.go:51:7:51:7 | a | stmts.go:51:9:51:9 | 0 | -| stmts.go:51:7:51:10 | assignment to element | stmts.go:51:7:51:21 | ... = ...[1] | -| stmts.go:51:7:51:10 | skip | stmts.go:51:13:51:13 | skip | -| stmts.go:51:7:51:10 | skip | stmts.go:60:1:60:1 | exit | -| stmts.go:51:7:51:21 | ... = ...[0] | stmts.go:51:7:51:10 | assignment to element | -| stmts.go:51:7:51:21 | ... = ...[1] | stmts.go:51:13:51:13 | assignment to w | -| stmts.go:51:9:51:9 | 0 | stmts.go:51:7:51:10 | skip | -| stmts.go:51:13:51:13 | assignment to w | stmts.go:52:3:52:13 | selection of Println | -| stmts.go:51:13:51:13 | skip | stmts.go:51:7:51:21 | ... = ...[0] | -| stmts.go:51:17:51:21 | <-... | stmts.go:51:7:51:7 | a | -| stmts.go:51:19:51:21 | ch2 | stmts.go:56:7:56:9 | ch1 | -| stmts.go:52:3:52:13 | selection of Println | stmts.go:52:15:52:15 | a | -| stmts.go:52:3:52:16 | call to Println | stmts.go:53:3:53:13 | selection of Println | -| stmts.go:52:3:52:16 | call to Println | stmts.go:60:1:60:1 | exit | -| stmts.go:52:15:52:15 | a | stmts.go:52:3:52:16 | call to Println | -| stmts.go:53:3:53:13 | selection of Println | stmts.go:53:15:53:15 | w | -| stmts.go:53:3:53:16 | call to Println | stmts.go:59:2:59:10 | select statement | -| stmts.go:53:3:53:16 | call to Println | stmts.go:60:1:60:1 | exit | -| stmts.go:53:15:53:15 | w | stmts.go:53:3:53:16 | call to Println | -| stmts.go:55:3:55:13 | selection of Println | stmts.go:55:3:55:15 | call to Println | -| stmts.go:55:3:55:15 | call to Println | stmts.go:59:2:59:10 | select statement | -| stmts.go:55:3:55:15 | call to Println | stmts.go:60:1:60:1 | exit | -| stmts.go:56:2:56:16 | skip | stmts.go:59:2:59:10 | select statement | -| stmts.go:56:7:56:9 | ch1 | stmts.go:56:14:56:15 | 42 | -| stmts.go:56:7:56:15 | send statement | stmts.go:56:2:56:16 | skip | -| stmts.go:56:7:56:15 | send statement | stmts.go:60:1:60:1 | exit | -| stmts.go:56:14:56:15 | 42 | stmts.go:48:2:57:2 | select statement | -| stmts.go:63:1:63:1 | entry | stmts.go:63:12:63:12 | argument corresponding to x | -| stmts.go:63:1:70:1 | function declaration | stmts.go:73:6:73:10 | skip | -| stmts.go:63:6:63:10 | skip | stmts.go:63:1:70:1 | function declaration | -| stmts.go:63:12:63:12 | argument corresponding to x | stmts.go:63:12:63:12 | initialization of x | -| stmts.go:63:12:63:12 | initialization of x | stmts.go:64:5:64:5 | x | -| stmts.go:64:5:64:5 | x | stmts.go:64:9:64:9 | 0 | -| stmts.go:64:5:64:9 | ...>... | stmts.go:64:9:64:9 | ...>... is false | -| stmts.go:64:5:64:9 | ...>... | stmts.go:64:9:64:9 | ...>... is true | -| stmts.go:64:9:64:9 | 0 | stmts.go:64:5:64:9 | ...>... | -| stmts.go:64:9:64:9 | ...>... is false | stmts.go:67:9:67:34 | function literal | -| stmts.go:64:9:64:9 | ...>... is true | stmts.go:65:9:65:33 | function literal | -| stmts.go:65:3:65:35 | defer statement | stmts.go:69:9:69:10 | 42 | -| stmts.go:65:9:65:9 | entry | stmts.go:65:18:65:28 | selection of Println | -| stmts.go:65:9:65:33 | function literal | stmts.go:65:3:65:35 | defer statement | -| stmts.go:65:9:65:35 | function call | stmts.go:70:1:70:1 | exit | -| stmts.go:65:18:65:28 | selection of Println | stmts.go:65:30:65:30 | x | -| stmts.go:65:18:65:31 | call to Println | stmts.go:65:33:65:33 | exit | -| stmts.go:65:30:65:30 | x | stmts.go:65:18:65:31 | call to Println | -| stmts.go:67:3:67:36 | defer statement | stmts.go:69:9:69:10 | 42 | +| stmts.go:3:1:3:12 | skip | stmts.go:10:6:10:10 | skip | +| stmts.go:10:1:10:1 | entry | stmts.go:10:12:10:12 | argument corresponding to b | +| stmts.go:10:1:43:1 | function declaration | stmts.go:46:6:46:10 | skip | +| stmts.go:10:6:10:10 | skip | stmts.go:10:1:43:1 | function declaration | +| stmts.go:10:12:10:12 | argument corresponding to b | stmts.go:10:12:10:12 | initialization of b | +| stmts.go:10:12:10:12 | initialization of b | stmts.go:12:7:12:7 | b | +| stmts.go:12:6:12:7 | !... | stmts.go:12:7:12:7 | !... is false | +| stmts.go:12:6:12:7 | !... | stmts.go:12:7:12:7 | !... is true | +| stmts.go:12:7:12:7 | !... is false | stmts.go:15:3:16:3 | skip | +| stmts.go:12:7:12:7 | !... is true | stmts.go:13:4:13:13 | skip | +| stmts.go:12:7:12:7 | b | stmts.go:12:6:12:7 | !... | +| stmts.go:13:4:13:13 | skip | stmts.go:23:6:23:9 | true | +| stmts.go:15:3:16:3 | skip | stmts.go:17:3:17:3 | skip | +| stmts.go:17:3:17:3 | skip | stmts.go:20:2:20:12 | selection of Println | +| stmts.go:20:2:20:12 | selection of Println | stmts.go:20:14:20:17 | "Hi" | +| stmts.go:20:2:20:18 | call to Println | stmts.go:23:6:23:9 | true | +| stmts.go:20:2:20:18 | call to Println | stmts.go:43:1:43:1 | exit | +| stmts.go:20:14:20:17 | "Hi" | stmts.go:20:2:20:18 | call to Println | +| stmts.go:23:6:23:9 | true | stmts.go:23:9:23:9 | true is true | +| stmts.go:23:9:23:9 | true is false | stmts.go:39:2:39:2 | skip | +| stmts.go:23:9:23:9 | true is true | stmts.go:24:7:24:7 | skip | +| stmts.go:24:7:24:7 | assignment to i | stmts.go:24:15:24:15 | i | +| stmts.go:24:7:24:7 | skip | stmts.go:24:12:24:12 | 0 | +| stmts.go:24:12:24:12 | 0 | stmts.go:24:7:24:7 | assignment to i | +| stmts.go:24:15:24:15 | i | stmts.go:24:19:24:20 | 10 | +| stmts.go:24:15:24:20 | ...<... | stmts.go:24:20:24:20 | ...<... is false | +| stmts.go:24:15:24:20 | ...<... | stmts.go:24:20:24:20 | ...<... is true | +| stmts.go:24:19:24:20 | 10 | stmts.go:24:15:24:20 | ...<... | +| stmts.go:24:20:24:20 | ...<... is false | stmts.go:23:6:23:9 | true | +| stmts.go:24:20:24:20 | ...<... is true | stmts.go:25:7:25:7 | skip | +| stmts.go:24:23:24:23 | i | stmts.go:24:23:24:25 | 1 | +| stmts.go:24:23:24:25 | 1 | stmts.go:24:23:24:25 | rhs of increment statement | +| stmts.go:24:23:24:25 | increment statement | stmts.go:24:15:24:15 | i | +| stmts.go:24:23:24:25 | rhs of increment statement | stmts.go:24:23:24:25 | increment statement | +| stmts.go:25:7:25:7 | assignment to j | stmts.go:25:19:25:19 | j | +| stmts.go:25:7:25:7 | skip | stmts.go:25:12:25:12 | i | +| stmts.go:25:12:25:12 | i | stmts.go:25:16:25:16 | 1 | +| stmts.go:25:12:25:16 | ...-... | stmts.go:25:7:25:7 | assignment to j | +| stmts.go:25:16:25:16 | 1 | stmts.go:25:12:25:16 | ...-... | +| stmts.go:25:19:25:19 | j | stmts.go:25:23:25:23 | 5 | +| stmts.go:25:19:25:23 | ...>... | stmts.go:25:23:25:23 | ...>... is false | +| stmts.go:25:19:25:23 | ...>... | stmts.go:25:23:25:23 | ...>... is true | +| stmts.go:25:23:25:23 | 5 | stmts.go:25:19:25:23 | ...>... | +| stmts.go:25:23:25:23 | ...>... is false | stmts.go:27:14:27:14 | i | +| stmts.go:25:23:25:23 | ...>... is true | stmts.go:26:5:26:15 | skip | +| stmts.go:26:5:26:15 | skip | stmts.go:39:2:39:2 | skip | +| stmts.go:27:14:27:14 | i | stmts.go:27:18:27:18 | 3 | +| stmts.go:27:14:27:18 | ...<... | stmts.go:27:18:27:18 | ...<... is false | +| stmts.go:27:14:27:18 | ...<... | stmts.go:27:18:27:18 | ...<... is true | +| stmts.go:27:18:27:18 | 3 | stmts.go:27:14:27:18 | ...<... | +| stmts.go:27:18:27:18 | ...<... is false | stmts.go:29:14:29:14 | i | +| stmts.go:27:18:27:18 | ...<... is true | stmts.go:28:5:28:9 | skip | +| stmts.go:28:5:28:9 | skip | stmts.go:23:6:23:9 | true | +| stmts.go:29:14:29:14 | i | stmts.go:29:19:29:19 | 9 | +| stmts.go:29:14:29:19 | ...!=... | stmts.go:29:19:29:19 | ...!=... is false | +| stmts.go:29:14:29:19 | ...!=... | stmts.go:29:19:29:19 | ...!=... is true | +| stmts.go:29:14:29:19 | ...!=... | stmts.go:43:1:43:1 | exit | +| stmts.go:29:19:29:19 | 9 | stmts.go:29:14:29:19 | ...!=... | +| stmts.go:29:19:29:19 | ...!=... is false | stmts.go:31:14:31:14 | i | +| stmts.go:29:19:29:19 | ...!=... is true | stmts.go:30:5:30:18 | skip | +| stmts.go:30:5:30:18 | skip | stmts.go:23:6:23:9 | true | +| stmts.go:31:14:31:14 | i | stmts.go:31:19:31:19 | 4 | +| stmts.go:31:14:31:19 | ...>=... | stmts.go:31:19:31:19 | ...>=... is false | +| stmts.go:31:14:31:19 | ...>=... | stmts.go:31:19:31:19 | ...>=... is true | +| stmts.go:31:19:31:19 | 4 | stmts.go:31:14:31:19 | ...>=... | +| stmts.go:31:19:31:19 | ...>=... is false | stmts.go:34:5:34:12 | skip | +| stmts.go:31:19:31:19 | ...>=... is true | stmts.go:32:5:32:14 | skip | +| stmts.go:32:5:32:14 | skip | stmts.go:23:6:23:9 | true | +| stmts.go:34:5:34:12 | skip | stmts.go:24:23:24:23 | i | +| stmts.go:39:2:39:2 | assignment to k | stmts.go:41:3:41:12 | skip | +| stmts.go:39:2:39:2 | skip | stmts.go:39:7:39:7 | 9 | +| stmts.go:39:7:39:7 | 9 | stmts.go:39:2:39:2 | assignment to k | +| stmts.go:40:10:40:10 | k | stmts.go:40:10:40:12 | 1 | +| stmts.go:40:10:40:12 | 1 | stmts.go:40:10:40:12 | rhs of increment statement | +| stmts.go:40:10:40:12 | increment statement | stmts.go:41:3:41:12 | skip | +| stmts.go:40:10:40:12 | rhs of increment statement | stmts.go:40:10:40:12 | increment statement | +| stmts.go:41:3:41:12 | skip | stmts.go:23:6:23:9 | true | +| stmts.go:46:1:46:1 | entry | stmts.go:46:12:46:14 | argument corresponding to ch1 | +| stmts.go:46:1:62:1 | function declaration | stmts.go:65:6:65:10 | skip | +| stmts.go:46:6:46:10 | skip | stmts.go:46:1:62:1 | function declaration | +| stmts.go:46:12:46:14 | argument corresponding to ch1 | stmts.go:46:12:46:14 | initialization of ch1 | +| stmts.go:46:12:46:14 | initialization of ch1 | stmts.go:46:26:46:28 | argument corresponding to ch2 | +| stmts.go:46:26:46:28 | argument corresponding to ch2 | stmts.go:46:26:46:28 | initialization of ch2 | +| stmts.go:46:26:46:28 | initialization of ch2 | stmts.go:47:6:47:6 | skip | +| stmts.go:47:6:47:6 | assignment to a | stmts.go:48:6:48:6 | skip | +| stmts.go:47:6:47:6 | skip | stmts.go:47:6:47:6 | zero value for a | +| stmts.go:47:6:47:6 | zero value for a | stmts.go:47:6:47:6 | assignment to a | +| stmts.go:48:6:48:6 | assignment to w | stmts.go:51:9:51:11 | ch1 | +| stmts.go:48:6:48:6 | skip | stmts.go:48:6:48:6 | zero value for w | +| stmts.go:48:6:48:6 | zero value for w | stmts.go:48:6:48:6 | assignment to w | +| stmts.go:50:2:59:2 | select statement | stmts.go:51:7:51:11 | <-... | +| stmts.go:50:2:59:2 | select statement | stmts.go:53:17:53:21 | <-... | +| stmts.go:50:2:59:2 | select statement | stmts.go:57:3:57:13 | selection of Println | +| stmts.go:50:2:59:2 | select statement | stmts.go:58:7:58:15 | send statement | +| stmts.go:51:7:51:11 | <-... | stmts.go:52:3:52:13 | selection of Println | +| stmts.go:51:9:51:11 | ch1 | stmts.go:53:19:53:21 | ch2 | +| stmts.go:52:3:52:13 | selection of Println | stmts.go:52:15:52:30 | "Heard from ch1" | +| stmts.go:52:3:52:31 | call to Println | stmts.go:61:2:61:10 | select statement | +| stmts.go:52:3:52:31 | call to Println | stmts.go:62:1:62:1 | exit | +| stmts.go:52:15:52:30 | "Heard from ch1" | stmts.go:52:3:52:31 | call to Println | +| stmts.go:53:7:53:7 | a | stmts.go:53:9:53:9 | 0 | +| stmts.go:53:7:53:10 | assignment to element | stmts.go:53:7:53:21 | ... = ...[1] | +| stmts.go:53:7:53:10 | skip | stmts.go:53:13:53:13 | skip | +| stmts.go:53:7:53:10 | skip | stmts.go:62:1:62:1 | exit | +| stmts.go:53:7:53:21 | ... = ...[0] | stmts.go:53:7:53:10 | assignment to element | +| stmts.go:53:7:53:21 | ... = ...[1] | stmts.go:53:13:53:13 | assignment to w | +| stmts.go:53:9:53:9 | 0 | stmts.go:53:7:53:10 | skip | +| stmts.go:53:13:53:13 | assignment to w | stmts.go:54:3:54:13 | selection of Println | +| stmts.go:53:13:53:13 | skip | stmts.go:53:7:53:21 | ... = ...[0] | +| stmts.go:53:17:53:21 | <-... | stmts.go:53:7:53:7 | a | +| stmts.go:53:19:53:21 | ch2 | stmts.go:58:7:58:9 | ch1 | +| stmts.go:54:3:54:13 | selection of Println | stmts.go:54:15:54:15 | a | +| stmts.go:54:3:54:16 | call to Println | stmts.go:55:3:55:13 | selection of Println | +| stmts.go:54:3:54:16 | call to Println | stmts.go:62:1:62:1 | exit | +| stmts.go:54:15:54:15 | a | stmts.go:54:3:54:16 | call to Println | +| stmts.go:55:3:55:13 | selection of Println | stmts.go:55:15:55:15 | w | +| stmts.go:55:3:55:16 | call to Println | stmts.go:61:2:61:10 | select statement | +| stmts.go:55:3:55:16 | call to Println | stmts.go:62:1:62:1 | exit | +| stmts.go:55:15:55:15 | w | stmts.go:55:3:55:16 | call to Println | +| stmts.go:57:3:57:13 | selection of Println | stmts.go:57:3:57:15 | call to Println | +| stmts.go:57:3:57:15 | call to Println | stmts.go:61:2:61:10 | select statement | +| stmts.go:57:3:57:15 | call to Println | stmts.go:62:1:62:1 | exit | +| stmts.go:58:2:58:16 | skip | stmts.go:61:2:61:10 | select statement | +| stmts.go:58:7:58:9 | ch1 | stmts.go:58:14:58:15 | 42 | +| stmts.go:58:7:58:15 | send statement | stmts.go:58:2:58:16 | skip | +| stmts.go:58:7:58:15 | send statement | stmts.go:62:1:62:1 | exit | +| stmts.go:58:14:58:15 | 42 | stmts.go:50:2:59:2 | select statement | +| stmts.go:65:1:65:1 | entry | stmts.go:65:12:65:12 | argument corresponding to x | +| stmts.go:65:1:72:1 | function declaration | stmts.go:75:6:75:10 | skip | +| stmts.go:65:6:65:10 | skip | stmts.go:65:1:72:1 | function declaration | +| stmts.go:65:12:65:12 | argument corresponding to x | stmts.go:65:12:65:12 | initialization of x | +| stmts.go:65:12:65:12 | initialization of x | stmts.go:66:5:66:5 | x | +| stmts.go:66:5:66:5 | x | stmts.go:66:9:66:9 | 0 | +| stmts.go:66:5:66:9 | ...>... | stmts.go:66:9:66:9 | ...>... is false | +| stmts.go:66:5:66:9 | ...>... | stmts.go:66:9:66:9 | ...>... is true | +| stmts.go:66:9:66:9 | 0 | stmts.go:66:5:66:9 | ...>... | +| stmts.go:66:9:66:9 | ...>... is false | stmts.go:69:9:69:34 | function literal | +| stmts.go:66:9:66:9 | ...>... is true | stmts.go:67:9:67:33 | function literal | +| stmts.go:67:3:67:35 | defer statement | stmts.go:71:9:71:10 | 42 | | stmts.go:67:9:67:9 | entry | stmts.go:67:18:67:28 | selection of Println | -| stmts.go:67:9:67:34 | function literal | stmts.go:67:3:67:36 | defer statement | -| stmts.go:67:9:67:36 | function call | stmts.go:70:1:70:1 | exit | -| stmts.go:67:18:67:28 | selection of Println | stmts.go:67:31:67:31 | x | -| stmts.go:67:18:67:32 | call to Println | stmts.go:67:34:67:34 | exit | -| stmts.go:67:30:67:31 | -... | stmts.go:67:18:67:32 | call to Println | -| stmts.go:67:31:67:31 | x | stmts.go:67:30:67:31 | -... | -| stmts.go:69:2:69:10 | return statement | stmts.go:65:9:65:35 | function call | -| stmts.go:69:2:69:10 | return statement | stmts.go:67:9:67:36 | function call | -| stmts.go:69:9:69:10 | 42 | stmts.go:69:2:69:10 | return statement | -| stmts.go:73:1:73:1 | entry | stmts.go:73:12:73:12 | argument corresponding to x | -| stmts.go:73:1:107:1 | function declaration | stmts.go:110:6:110:10 | skip | -| stmts.go:73:6:73:10 | skip | stmts.go:73:1:107:1 | function declaration | -| stmts.go:73:12:73:12 | argument corresponding to x | stmts.go:73:12:73:12 | initialization of x | -| stmts.go:73:12:73:12 | initialization of x | stmts.go:74:9:74:9 | x | -| stmts.go:74:9:74:9 | x | stmts.go:77:9:77:9 | skip | -| stmts.go:77:9:77:9 | assignment to y | stmts.go:77:17:77:17 | y | -| stmts.go:77:9:77:9 | skip | stmts.go:77:14:77:14 | x | -| stmts.go:77:14:77:14 | x | stmts.go:77:9:77:9 | assignment to y | -| stmts.go:77:17:77:17 | y | stmts.go:77:21:77:22 | 19 | -| stmts.go:77:17:77:22 | ...-... | stmts.go:79:3:79:7 | test5 | -| stmts.go:77:21:77:22 | 19 | stmts.go:77:17:77:22 | ...-... | -| stmts.go:79:3:79:7 | test5 | stmts.go:79:9:79:13 | false | -| stmts.go:79:3:79:14 | call to test5 | stmts.go:107:1:107:1 | exit | -| stmts.go:79:9:79:13 | false | stmts.go:79:3:79:14 | call to test5 | -| stmts.go:82:9:82:9 | x | stmts.go:83:7:83:7 | 1 | -| stmts.go:82:9:82:9 | x | stmts.go:88:9:88:9 | x | -| stmts.go:83:2:83:8 | skip | stmts.go:88:9:88:9 | x | -| stmts.go:83:7:83:7 | 1 | stmts.go:83:7:83:7 | case 1 | -| stmts.go:83:7:83:7 | case 1 | stmts.go:83:2:83:8 | skip | -| stmts.go:83:7:83:7 | case 1 | stmts.go:84:7:84:7 | 2 | -| stmts.go:84:7:84:7 | 2 | stmts.go:84:7:84:7 | case 2 | -| stmts.go:84:7:84:7 | case 2 | stmts.go:84:10:84:10 | 3 | -| stmts.go:84:7:84:7 | case 2 | stmts.go:85:3:85:7 | test5 | -| stmts.go:84:10:84:10 | 3 | stmts.go:84:10:84:10 | case 3 | -| stmts.go:84:10:84:10 | case 3 | stmts.go:85:3:85:7 | test5 | -| stmts.go:84:10:84:10 | case 3 | stmts.go:88:9:88:9 | x | -| stmts.go:85:3:85:7 | test5 | stmts.go:85:9:85:12 | true | -| stmts.go:85:9:85:12 | true | stmts.go:85:3:85:13 | call to test5 | -| stmts.go:88:9:88:9 | x | stmts.go:89:7:89:7 | 1 | -| stmts.go:88:9:88:9 | x | stmts.go:96:9:96:9 | x | -| stmts.go:89:7:89:7 | 1 | stmts.go:89:7:89:7 | case 1 | -| stmts.go:89:7:89:7 | case 1 | stmts.go:90:3:90:7 | test5 | -| stmts.go:89:7:89:7 | case 1 | stmts.go:92:7:92:11 | ...-... | -| stmts.go:90:3:90:7 | test5 | stmts.go:90:9:90:13 | false | -| stmts.go:90:9:90:13 | false | stmts.go:90:3:90:14 | call to test5 | -| stmts.go:91:3:91:13 | skip | stmts.go:93:3:93:7 | test5 | -| stmts.go:92:7:92:11 | ...-... | stmts.go:92:7:92:11 | case ...-... | -| stmts.go:92:7:92:11 | case ...-... | stmts.go:93:3:93:7 | test5 | -| stmts.go:92:7:92:11 | case ...-... | stmts.go:96:9:96:9 | x | -| stmts.go:93:3:93:7 | test5 | stmts.go:93:9:93:12 | true | -| stmts.go:93:9:93:12 | true | stmts.go:93:3:93:13 | call to test5 | -| stmts.go:96:9:96:9 | x | stmts.go:98:7:98:7 | 2 | -| stmts.go:97:2:97:9 | skip | stmts.go:102:2:102:2 | true | -| stmts.go:98:7:98:7 | 2 | stmts.go:98:7:98:7 | case 2 | -| stmts.go:98:7:98:7 | case 2 | stmts.go:97:2:97:9 | skip | -| stmts.go:98:7:98:7 | case 2 | stmts.go:99:3:99:7 | test5 | -| stmts.go:99:3:99:7 | test5 | stmts.go:99:9:99:12 | true | -| stmts.go:99:9:99:12 | true | stmts.go:99:3:99:13 | call to test5 | -| stmts.go:102:2:102:2 | true | stmts.go:105:7:105:10 | true | -| stmts.go:105:7:105:10 | case true | stmts.go:105:10:105:10 | true is false | -| stmts.go:105:7:105:10 | case true | stmts.go:105:10:105:10 | true is true | -| stmts.go:105:7:105:10 | true | stmts.go:105:7:105:10 | case true | -| stmts.go:105:10:105:10 | true is false | stmts.go:104:3:104:7 | skip | -| stmts.go:105:10:105:10 | true is true | stmts.go:105:2:105:11 | skip | -| stmts.go:110:1:110:1 | entry | stmts.go:110:12:110:12 | argument corresponding to x | -| stmts.go:110:1:123:1 | function declaration | stmts.go:126:6:126:11 | skip | -| stmts.go:110:6:110:10 | skip | stmts.go:110:1:123:1 | function declaration | -| stmts.go:110:12:110:12 | argument corresponding to x | stmts.go:110:12:110:12 | initialization of x | -| stmts.go:110:12:110:12 | initialization of x | stmts.go:111:9:111:9 | skip | -| stmts.go:111:9:111:9 | assignment to y | stmts.go:112:7:112:11 | case error | -| stmts.go:111:9:111:9 | assignment to y | stmts.go:119:9:119:9 | skip | -| stmts.go:111:9:111:9 | skip | stmts.go:111:14:111:14 | x | -| stmts.go:111:14:111:14 | x | stmts.go:111:14:111:21 | type assertion | -| stmts.go:111:14:111:21 | type assertion | stmts.go:111:9:111:9 | assignment to y | -| stmts.go:112:7:112:11 | case error | stmts.go:112:14:112:19 | case string | -| stmts.go:112:7:112:11 | case error | stmts.go:113:3:113:13 | selection of Println | -| stmts.go:112:14:112:19 | case string | stmts.go:113:3:113:13 | selection of Println | -| stmts.go:112:14:112:19 | case string | stmts.go:114:7:114:13 | case float32 | -| stmts.go:113:3:113:13 | selection of Println | stmts.go:113:15:113:15 | y | -| stmts.go:113:3:113:16 | call to Println | stmts.go:119:9:119:9 | skip | -| stmts.go:113:3:113:16 | call to Println | stmts.go:123:1:123:1 | exit | -| stmts.go:113:15:113:15 | y | stmts.go:113:3:113:16 | call to Println | -| stmts.go:114:7:114:13 | case float32 | stmts.go:115:3:115:7 | test5 | -| stmts.go:114:7:114:13 | case float32 | stmts.go:119:9:119:9 | skip | -| stmts.go:115:3:115:7 | test5 | stmts.go:115:9:115:12 | true | -| stmts.go:115:3:115:13 | call to test5 | stmts.go:123:1:123:1 | exit | -| stmts.go:115:9:115:12 | true | stmts.go:115:3:115:13 | call to test5 | -| stmts.go:116:3:116:7 | test5 | stmts.go:116:9:116:13 | false | -| stmts.go:116:9:116:13 | false | stmts.go:116:3:116:14 | call to test5 | -| stmts.go:119:9:119:9 | assignment to y | stmts.go:119:17:119:17 | y | -| stmts.go:119:9:119:9 | skip | stmts.go:119:14:119:14 | x | -| stmts.go:119:14:119:14 | x | stmts.go:119:9:119:9 | assignment to y | -| stmts.go:119:17:119:17 | y | stmts.go:119:17:119:24 | type assertion | -| stmts.go:119:17:119:24 | type assertion | stmts.go:121:3:121:7 | test5 | -| stmts.go:121:3:121:7 | test5 | stmts.go:121:9:121:13 | false | -| stmts.go:121:3:121:14 | call to test5 | stmts.go:123:1:123:1 | exit | -| stmts.go:121:9:121:13 | false | stmts.go:121:3:121:14 | call to test5 | -| stmts.go:126:1:126:1 | entry | stmts.go:126:13:126:13 | argument corresponding to f | -| stmts.go:126:1:128:1 | function declaration | stmts.go:131:6:131:11 | skip | -| stmts.go:126:6:126:11 | skip | stmts.go:126:1:128:1 | function declaration | -| stmts.go:126:13:126:13 | argument corresponding to f | stmts.go:126:13:126:13 | initialization of f | -| stmts.go:126:13:126:13 | initialization of f | stmts.go:127:5:127:5 | f | -| stmts.go:127:2:127:7 | go statement | stmts.go:128:1:128:1 | exit | -| stmts.go:127:5:127:5 | f | stmts.go:127:2:127:7 | go statement | -| stmts.go:131:1:131:1 | entry | stmts.go:131:13:131:14 | argument corresponding to xs | -| stmts.go:131:1:145:1 | function declaration | stmts.go:0:0:0:0 | exit | -| stmts.go:131:6:131:11 | skip | stmts.go:131:1:145:1 | function declaration | -| stmts.go:131:13:131:14 | argument corresponding to xs | stmts.go:131:13:131:14 | initialization of xs | -| stmts.go:131:13:131:14 | initialization of xs | stmts.go:132:17:132:18 | xs | -| stmts.go:132:2:137:2 | range statement[0] | stmts.go:132:6:132:6 | assignment to x | -| stmts.go:132:6:132:6 | assignment to x | stmts.go:133:6:133:6 | x | -| stmts.go:132:6:132:6 | skip | stmts.go:132:2:137:2 | range statement[0] | -| stmts.go:132:17:132:18 | next key-value pair in range | stmts.go:132:6:132:6 | skip | -| stmts.go:132:17:132:18 | next key-value pair in range | stmts.go:139:20:139:21 | xs | -| stmts.go:132:17:132:18 | xs | stmts.go:132:17:132:18 | next key-value pair in range | -| stmts.go:133:6:133:6 | x | stmts.go:133:10:133:10 | 5 | -| stmts.go:133:6:133:10 | ...>... | stmts.go:133:10:133:10 | ...>... is false | -| stmts.go:133:6:133:10 | ...>... | stmts.go:133:10:133:10 | ...>... is true | -| stmts.go:133:10:133:10 | 5 | stmts.go:133:6:133:10 | ...>... | -| stmts.go:133:10:133:10 | ...>... is false | stmts.go:136:3:136:11 | selection of Print | -| stmts.go:133:10:133:10 | ...>... is true | stmts.go:134:4:134:11 | skip | -| stmts.go:134:4:134:11 | skip | stmts.go:132:17:132:18 | next key-value pair in range | -| stmts.go:136:3:136:11 | selection of Print | stmts.go:136:13:136:13 | x | -| stmts.go:136:3:136:14 | call to Print | stmts.go:132:17:132:18 | next key-value pair in range | -| stmts.go:136:3:136:14 | call to Print | stmts.go:145:1:145:1 | exit | -| stmts.go:136:13:136:13 | x | stmts.go:136:3:136:14 | call to Print | -| stmts.go:139:2:141:2 | range statement[0] | stmts.go:139:2:141:2 | range statement[1] | -| stmts.go:139:2:141:2 | range statement[1] | stmts.go:139:6:139:6 | assignment to i | -| stmts.go:139:6:139:6 | assignment to i | stmts.go:139:9:139:9 | assignment to v | -| stmts.go:139:6:139:6 | skip | stmts.go:139:9:139:9 | skip | -| stmts.go:139:9:139:9 | assignment to v | stmts.go:140:3:140:11 | selection of Print | -| stmts.go:139:9:139:9 | skip | stmts.go:139:2:141:2 | range statement[0] | -| stmts.go:139:20:139:21 | next key-value pair in range | stmts.go:139:6:139:6 | skip | -| stmts.go:139:20:139:21 | next key-value pair in range | stmts.go:143:12:143:13 | xs | -| stmts.go:139:20:139:21 | xs | stmts.go:139:20:139:21 | next key-value pair in range | -| stmts.go:140:3:140:11 | selection of Print | stmts.go:140:13:140:13 | i | -| stmts.go:140:3:140:17 | call to Print | stmts.go:139:20:139:21 | next key-value pair in range | -| stmts.go:140:3:140:17 | call to Print | stmts.go:145:1:145:1 | exit | -| stmts.go:140:13:140:13 | i | stmts.go:140:16:140:16 | v | -| stmts.go:140:16:140:16 | v | stmts.go:140:3:140:17 | call to Print | -| stmts.go:143:12:143:13 | next key-value pair in range | stmts.go:143:15:144:2 | skip | -| stmts.go:143:12:143:13 | next key-value pair in range | stmts.go:145:1:145:1 | exit | -| stmts.go:143:12:143:13 | xs | stmts.go:143:12:143:13 | next key-value pair in range | -| stmts.go:143:15:144:2 | skip | stmts.go:143:12:143:13 | next key-value pair in range | +| stmts.go:67:9:67:33 | function literal | stmts.go:67:3:67:35 | defer statement | +| stmts.go:67:9:67:35 | function call | stmts.go:72:1:72:1 | exit | +| stmts.go:67:18:67:28 | selection of Println | stmts.go:67:30:67:30 | x | +| stmts.go:67:18:67:31 | call to Println | stmts.go:67:33:67:33 | exit | +| stmts.go:67:30:67:30 | x | stmts.go:67:18:67:31 | call to Println | +| stmts.go:69:3:69:36 | defer statement | stmts.go:71:9:71:10 | 42 | +| stmts.go:69:9:69:9 | entry | stmts.go:69:18:69:28 | selection of Println | +| stmts.go:69:9:69:34 | function literal | stmts.go:69:3:69:36 | defer statement | +| stmts.go:69:9:69:36 | function call | stmts.go:72:1:72:1 | exit | +| stmts.go:69:18:69:28 | selection of Println | stmts.go:69:31:69:31 | x | +| stmts.go:69:18:69:32 | call to Println | stmts.go:69:34:69:34 | exit | +| stmts.go:69:30:69:31 | -... | stmts.go:69:18:69:32 | call to Println | +| stmts.go:69:31:69:31 | x | stmts.go:69:30:69:31 | -... | +| stmts.go:71:2:71:10 | return statement | stmts.go:67:9:67:35 | function call | +| stmts.go:71:2:71:10 | return statement | stmts.go:69:9:69:36 | function call | +| stmts.go:71:9:71:10 | 42 | stmts.go:71:2:71:10 | return statement | +| stmts.go:75:1:75:1 | entry | stmts.go:75:12:75:12 | argument corresponding to x | +| stmts.go:75:1:109:1 | function declaration | stmts.go:112:6:112:10 | skip | +| stmts.go:75:6:75:10 | skip | stmts.go:75:1:109:1 | function declaration | +| stmts.go:75:12:75:12 | argument corresponding to x | stmts.go:75:12:75:12 | initialization of x | +| stmts.go:75:12:75:12 | initialization of x | stmts.go:76:9:76:9 | x | +| stmts.go:76:9:76:9 | x | stmts.go:79:9:79:9 | skip | +| stmts.go:79:9:79:9 | assignment to y | stmts.go:79:17:79:17 | y | +| stmts.go:79:9:79:9 | skip | stmts.go:79:14:79:14 | x | +| stmts.go:79:14:79:14 | x | stmts.go:79:9:79:9 | assignment to y | +| stmts.go:79:17:79:17 | y | stmts.go:79:21:79:22 | 19 | +| stmts.go:79:17:79:22 | ...-... | stmts.go:81:3:81:7 | test5 | +| stmts.go:79:21:79:22 | 19 | stmts.go:79:17:79:22 | ...-... | +| stmts.go:81:3:81:7 | test5 | stmts.go:81:9:81:13 | false | +| stmts.go:81:3:81:14 | call to test5 | stmts.go:109:1:109:1 | exit | +| stmts.go:81:9:81:13 | false | stmts.go:81:3:81:14 | call to test5 | +| stmts.go:84:9:84:9 | x | stmts.go:85:7:85:7 | 1 | +| stmts.go:84:9:84:9 | x | stmts.go:90:9:90:9 | x | +| stmts.go:85:2:85:8 | skip | stmts.go:90:9:90:9 | x | +| stmts.go:85:7:85:7 | 1 | stmts.go:85:7:85:7 | case 1 | +| stmts.go:85:7:85:7 | case 1 | stmts.go:85:2:85:8 | skip | +| stmts.go:85:7:85:7 | case 1 | stmts.go:86:7:86:7 | 2 | +| stmts.go:86:7:86:7 | 2 | stmts.go:86:7:86:7 | case 2 | +| stmts.go:86:7:86:7 | case 2 | stmts.go:86:10:86:10 | 3 | +| stmts.go:86:7:86:7 | case 2 | stmts.go:87:3:87:7 | test5 | +| stmts.go:86:10:86:10 | 3 | stmts.go:86:10:86:10 | case 3 | +| stmts.go:86:10:86:10 | case 3 | stmts.go:87:3:87:7 | test5 | +| stmts.go:86:10:86:10 | case 3 | stmts.go:90:9:90:9 | x | +| stmts.go:87:3:87:7 | test5 | stmts.go:87:9:87:12 | true | +| stmts.go:87:9:87:12 | true | stmts.go:87:3:87:13 | call to test5 | +| stmts.go:90:9:90:9 | x | stmts.go:91:7:91:7 | 1 | +| stmts.go:90:9:90:9 | x | stmts.go:98:9:98:9 | x | +| stmts.go:91:7:91:7 | 1 | stmts.go:91:7:91:7 | case 1 | +| stmts.go:91:7:91:7 | case 1 | stmts.go:92:3:92:7 | test5 | +| stmts.go:91:7:91:7 | case 1 | stmts.go:94:7:94:11 | ...-... | +| stmts.go:92:3:92:7 | test5 | stmts.go:92:9:92:13 | false | +| stmts.go:92:9:92:13 | false | stmts.go:92:3:92:14 | call to test5 | +| stmts.go:93:3:93:13 | skip | stmts.go:95:3:95:7 | test5 | +| stmts.go:94:7:94:11 | ...-... | stmts.go:94:7:94:11 | case ...-... | +| stmts.go:94:7:94:11 | case ...-... | stmts.go:95:3:95:7 | test5 | +| stmts.go:94:7:94:11 | case ...-... | stmts.go:98:9:98:9 | x | +| stmts.go:95:3:95:7 | test5 | stmts.go:95:9:95:12 | true | +| stmts.go:95:9:95:12 | true | stmts.go:95:3:95:13 | call to test5 | +| stmts.go:98:9:98:9 | x | stmts.go:100:7:100:7 | 2 | +| stmts.go:99:2:99:9 | skip | stmts.go:104:2:104:2 | true | +| stmts.go:100:7:100:7 | 2 | stmts.go:100:7:100:7 | case 2 | +| stmts.go:100:7:100:7 | case 2 | stmts.go:99:2:99:9 | skip | +| stmts.go:100:7:100:7 | case 2 | stmts.go:101:3:101:7 | test5 | +| stmts.go:101:3:101:7 | test5 | stmts.go:101:9:101:12 | true | +| stmts.go:101:9:101:12 | true | stmts.go:101:3:101:13 | call to test5 | +| stmts.go:104:2:104:2 | true | stmts.go:107:7:107:10 | true | +| stmts.go:107:7:107:10 | case true | stmts.go:107:10:107:10 | true is false | +| stmts.go:107:7:107:10 | case true | stmts.go:107:10:107:10 | true is true | +| stmts.go:107:7:107:10 | true | stmts.go:107:7:107:10 | case true | +| stmts.go:107:10:107:10 | true is false | stmts.go:106:3:106:7 | skip | +| stmts.go:107:10:107:10 | true is true | stmts.go:107:2:107:11 | skip | +| stmts.go:112:1:112:1 | entry | stmts.go:112:12:112:12 | argument corresponding to x | +| stmts.go:112:1:125:1 | function declaration | stmts.go:128:6:128:11 | skip | +| stmts.go:112:6:112:10 | skip | stmts.go:112:1:125:1 | function declaration | +| stmts.go:112:12:112:12 | argument corresponding to x | stmts.go:112:12:112:12 | initialization of x | +| stmts.go:112:12:112:12 | initialization of x | stmts.go:113:9:113:9 | skip | +| stmts.go:113:9:113:9 | assignment to y | stmts.go:114:7:114:11 | case error | +| stmts.go:113:9:113:9 | assignment to y | stmts.go:121:9:121:9 | skip | +| stmts.go:113:9:113:9 | skip | stmts.go:113:14:113:14 | x | +| stmts.go:113:14:113:14 | x | stmts.go:113:14:113:21 | type assertion | +| stmts.go:113:14:113:21 | type assertion | stmts.go:113:9:113:9 | assignment to y | +| stmts.go:114:7:114:11 | case error | stmts.go:114:14:114:19 | case string | +| stmts.go:114:7:114:11 | case error | stmts.go:115:3:115:13 | selection of Println | +| stmts.go:114:14:114:19 | case string | stmts.go:115:3:115:13 | selection of Println | +| stmts.go:114:14:114:19 | case string | stmts.go:116:7:116:13 | case float32 | +| stmts.go:115:3:115:13 | selection of Println | stmts.go:115:15:115:15 | y | +| stmts.go:115:3:115:16 | call to Println | stmts.go:121:9:121:9 | skip | +| stmts.go:115:3:115:16 | call to Println | stmts.go:125:1:125:1 | exit | +| stmts.go:115:15:115:15 | y | stmts.go:115:3:115:16 | call to Println | +| stmts.go:116:7:116:13 | case float32 | stmts.go:117:3:117:7 | test5 | +| stmts.go:116:7:116:13 | case float32 | stmts.go:121:9:121:9 | skip | +| stmts.go:117:3:117:7 | test5 | stmts.go:117:9:117:12 | true | +| stmts.go:117:3:117:13 | call to test5 | stmts.go:125:1:125:1 | exit | +| stmts.go:117:9:117:12 | true | stmts.go:117:3:117:13 | call to test5 | +| stmts.go:118:3:118:7 | test5 | stmts.go:118:9:118:13 | false | +| stmts.go:118:9:118:13 | false | stmts.go:118:3:118:14 | call to test5 | +| stmts.go:121:9:121:9 | assignment to y | stmts.go:121:17:121:17 | y | +| stmts.go:121:9:121:9 | skip | stmts.go:121:14:121:14 | x | +| stmts.go:121:14:121:14 | x | stmts.go:121:9:121:9 | assignment to y | +| stmts.go:121:17:121:17 | y | stmts.go:121:17:121:24 | type assertion | +| stmts.go:121:17:121:24 | type assertion | stmts.go:123:3:123:7 | test5 | +| stmts.go:123:3:123:7 | test5 | stmts.go:123:9:123:13 | false | +| stmts.go:123:3:123:14 | call to test5 | stmts.go:125:1:125:1 | exit | +| stmts.go:123:9:123:13 | false | stmts.go:123:3:123:14 | call to test5 | +| stmts.go:128:1:128:1 | entry | stmts.go:128:13:128:13 | argument corresponding to f | +| stmts.go:128:1:130:1 | function declaration | stmts.go:133:6:133:11 | skip | +| stmts.go:128:6:128:11 | skip | stmts.go:128:1:130:1 | function declaration | +| stmts.go:128:13:128:13 | argument corresponding to f | stmts.go:128:13:128:13 | initialization of f | +| stmts.go:128:13:128:13 | initialization of f | stmts.go:129:5:129:5 | f | +| stmts.go:129:2:129:7 | go statement | stmts.go:130:1:130:1 | exit | +| stmts.go:129:5:129:5 | f | stmts.go:129:2:129:7 | go statement | +| stmts.go:133:1:133:1 | entry | stmts.go:133:13:133:14 | argument corresponding to xs | +| stmts.go:133:1:147:1 | function declaration | stmts.go:0:0:0:0 | exit | +| stmts.go:133:6:133:11 | skip | stmts.go:133:1:147:1 | function declaration | +| stmts.go:133:13:133:14 | argument corresponding to xs | stmts.go:133:13:133:14 | initialization of xs | +| stmts.go:133:13:133:14 | initialization of xs | stmts.go:134:17:134:18 | xs | +| stmts.go:134:2:139:2 | range statement[0] | stmts.go:134:6:134:6 | assignment to x | +| stmts.go:134:6:134:6 | assignment to x | stmts.go:135:6:135:6 | x | +| stmts.go:134:6:134:6 | skip | stmts.go:134:2:139:2 | range statement[0] | +| stmts.go:134:17:134:18 | next key-value pair in range | stmts.go:134:6:134:6 | skip | +| stmts.go:134:17:134:18 | next key-value pair in range | stmts.go:141:20:141:21 | xs | +| stmts.go:134:17:134:18 | xs | stmts.go:134:17:134:18 | next key-value pair in range | +| stmts.go:135:6:135:6 | x | stmts.go:135:10:135:10 | 5 | +| stmts.go:135:6:135:10 | ...>... | stmts.go:135:10:135:10 | ...>... is false | +| stmts.go:135:6:135:10 | ...>... | stmts.go:135:10:135:10 | ...>... is true | +| stmts.go:135:10:135:10 | 5 | stmts.go:135:6:135:10 | ...>... | +| stmts.go:135:10:135:10 | ...>... is false | stmts.go:138:3:138:11 | selection of Print | +| stmts.go:135:10:135:10 | ...>... is true | stmts.go:136:4:136:11 | skip | +| stmts.go:136:4:136:11 | skip | stmts.go:134:17:134:18 | next key-value pair in range | +| stmts.go:138:3:138:11 | selection of Print | stmts.go:138:13:138:13 | x | +| stmts.go:138:3:138:14 | call to Print | stmts.go:134:17:134:18 | next key-value pair in range | +| stmts.go:138:3:138:14 | call to Print | stmts.go:147:1:147:1 | exit | +| stmts.go:138:13:138:13 | x | stmts.go:138:3:138:14 | call to Print | +| stmts.go:141:2:143:2 | range statement[0] | stmts.go:141:2:143:2 | range statement[1] | +| stmts.go:141:2:143:2 | range statement[1] | stmts.go:141:6:141:6 | assignment to i | +| stmts.go:141:6:141:6 | assignment to i | stmts.go:141:9:141:9 | assignment to v | +| stmts.go:141:6:141:6 | skip | stmts.go:141:9:141:9 | skip | +| stmts.go:141:9:141:9 | assignment to v | stmts.go:142:3:142:11 | selection of Print | +| stmts.go:141:9:141:9 | skip | stmts.go:141:2:143:2 | range statement[0] | +| stmts.go:141:20:141:21 | next key-value pair in range | stmts.go:141:6:141:6 | skip | +| stmts.go:141:20:141:21 | next key-value pair in range | stmts.go:145:12:145:13 | xs | +| stmts.go:141:20:141:21 | xs | stmts.go:141:20:141:21 | next key-value pair in range | +| stmts.go:142:3:142:11 | selection of Print | stmts.go:142:13:142:13 | i | +| stmts.go:142:3:142:17 | call to Print | stmts.go:141:20:141:21 | next key-value pair in range | +| stmts.go:142:3:142:17 | call to Print | stmts.go:147:1:147:1 | exit | +| stmts.go:142:13:142:13 | i | stmts.go:142:16:142:16 | v | +| stmts.go:142:16:142:16 | v | stmts.go:142:3:142:17 | call to Print | +| stmts.go:145:12:145:13 | next key-value pair in range | stmts.go:145:15:146:2 | skip | +| stmts.go:145:12:145:13 | next key-value pair in range | stmts.go:147:1:147:1 | exit | +| stmts.go:145:12:145:13 | xs | stmts.go:145:12:145:13 | next key-value pair in range | +| stmts.go:145:15:146:2 | skip | stmts.go:145:12:145:13 | next key-value pair in range | | tst.go:0:0:0:0 | entry | tst.go:3:6:3:10 | skip | | tst.go:3:1:3:1 | entry | tst.go:3:12:3:12 | argument corresponding to x | | tst.go:3:1:12:1 | function declaration | tst.go:14:6:14:11 | skip | @@ -1278,11 +1278,11 @@ | tst.go:18:38:18:38 | ...<... is false | tst.go:21:1:21:1 | exit | | tst.go:18:38:18:38 | ...<... is true | tst.go:18:2:18:39 | skip | | tst.go:23:1:23:1 | entry | tst.go:24:2:24:2 | true | -| tst.go:23:1:25:1 | function declaration | tst.go:27:6:27:11 | skip | -| tst.go:23:6:23:11 | skip | tst.go:23:1:25:1 | function declaration | -| tst.go:24:2:24:2 | true | tst.go:25:1:25:1 | exit | -| tst.go:27:1:27:1 | entry | tst.go:28:2:28:2 | true | -| tst.go:27:1:31:1 | function declaration | tst.go:0:0:0:0 | exit | -| tst.go:27:6:27:11 | skip | tst.go:27:1:31:1 | function declaration | -| tst.go:28:2:28:2 | true | tst.go:29:2:29:9 | skip | -| tst.go:29:2:29:9 | skip | tst.go:31:1:31:1 | exit | +| tst.go:23:1:26:1 | function declaration | tst.go:28:6:28:11 | skip | +| tst.go:23:6:23:11 | skip | tst.go:23:1:26:1 | function declaration | +| tst.go:24:2:24:2 | true | tst.go:26:1:26:1 | exit | +| tst.go:28:1:28:1 | entry | tst.go:29:2:29:2 | true | +| tst.go:28:1:32:1 | function declaration | tst.go:0:0:0:0 | exit | +| tst.go:28:6:28:11 | skip | tst.go:28:1:32:1 | function declaration | +| tst.go:29:2:29:2 | true | tst.go:30:2:30:9 | skip | +| tst.go:30:2:30:9 | skip | tst.go:32:1:32:1 | exit | diff --git a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/NoretFunctions.expected b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/NoretFunctions.expected index 2fcfd4dc811..abd09c52976 100644 --- a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/NoretFunctions.expected +++ b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/NoretFunctions.expected @@ -6,6 +6,6 @@ | noretfunctions.go:20:6:20:22 | noRetUsesLogFatal | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | | noretfunctions.go:24:6:24:23 | noRetUsesLogFatalf | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | | stmts7.go:10:6:10:15 | canRecover | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | -| stmts.go:8:6:8:10 | test5 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | -| stmts.go:44:6:44:10 | test6 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | -| stmts.go:110:6:110:10 | test9 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | +| stmts.go:10:6:10:10 | test5 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | +| stmts.go:46:6:46:10 | test6 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | +| stmts.go:112:6:112:10 | test9 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph | diff --git a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/stmts.go b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/stmts.go index f9fddbd5504..9d81188faaf 100644 --- a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/stmts.go +++ b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/stmts.go @@ -4,6 +4,8 @@ import "fmt" // NOTE: after auto-formatting this file, make sure to put back the empty statement on line 15 below +// autoformat-ignore (in line with the NOTE above) + // simple statements and for loops func test5(b bool) { { diff --git a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/tst.go b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/tst.go index ccba142881b..cad9b5db207 100644 --- a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/tst.go +++ b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/tst.go @@ -21,7 +21,8 @@ func check2(value int64) { } func check3() { - switch { } + switch { + } } func check4() { diff --git a/ql/test/query-tests/AlertSuppression/AlertSuppression.expected b/ql/test/query-tests/AlertSuppression/AlertSuppression.expected index cae4195eda2..7dd8ba68338 100644 --- a/ql/test/query-tests/AlertSuppression/AlertSuppression.expected +++ b/ql/test/query-tests/AlertSuppression/AlertSuppression.expected @@ -1,61 +1,61 @@ | AlertSuppressionExample.go:11:42:11:74 | comment | lgtm[go/hardcoded-credentials] | lgtm[go/hardcoded-credentials] | AlertSuppressionExample.go:11:1:11:74 | suppression range | -| tst.go:5:8:5:14 | comment | lgtm | lgtm | tst.go:5:1:5:14 | suppression range | -| tst.go:6:8:6:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:6:1:6:39 | suppression range | -| tst.go:7:8:7:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:7:1:7:39 | suppression range | -| tst.go:8:8:8:63 | comment | lgtm[go/redundant-assignment, go/redundant-operation] | lgtm[go/redundant-assignment, go/redundant-operation] | tst.go:8:1:8:63 | suppression range | -| tst.go:9:8:9:29 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tst.go:9:1:9:29 | suppression range | -| tst.go:10:8:10:53 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tst.go:10:1:10:53 | suppression range | -| tst.go:11:8:11:35 | comment | lgtm[@expires:2017-06-11] | lgtm[@expires:2017-06-11] | tst.go:11:1:11:35 | suppression range | -| tst.go:12:8:12:70 | comment | lgtm[go/redundant-operation] because I know better than lgtm | lgtm[go/redundant-operation] | tst.go:12:1:12:70 | suppression range | -| tst.go:13:8:13:25 | comment | lgtm: blah blah | lgtm | tst.go:13:1:13:25 | suppression range | -| tst.go:14:8:14:39 | comment | lgtm blah blah #falsepositive | lgtm | tst.go:14:1:14:39 | suppression range | -| tst.go:15:8:15:39 | comment | lgtm [go/redundant-operation] | lgtm [go/redundant-operation] | tst.go:15:1:15:39 | suppression range | -| tst.go:16:8:16:17 | comment | lgtm | lgtm | tst.go:16:1:16:17 | suppression range | -| tst.go:17:8:17:16 | comment | lgtm[] | lgtm[] | tst.go:17:1:17:16 | suppression range | -| tst.go:19:8:19:13 | comment | lgtm | lgtm | tst.go:19:1:19:13 | suppression range | -| tst.go:20:8:20:14 | comment | \tlgtm | lgtm | tst.go:20:1:20:14 | suppression range | -| tst.go:21:8:21:40 | comment | lgtm\t[go/redundant-assignment] | lgtm\t[go/redundant-assignment] | tst.go:21:1:21:40 | suppression range | -| tst.go:24:8:24:19 | comment | foo; lgtm | lgtm | tst.go:24:1:24:19 | suppression range | -| tst.go:25:8:25:44 | comment | foo; lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:25:1:25:44 | suppression range | -| tst.go:27:8:27:43 | comment | foo lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:27:1:27:43 | suppression range | -| tst.go:29:8:29:47 | comment | foo lgtm[go/redundant-assignment] bar | lgtm[go/redundant-assignment] | tst.go:29:1:29:47 | suppression range | -| tst.go:30:8:30:15 | comment | LGTM! | LGTM | tst.go:30:1:30:15 | suppression range | -| tst.go:31:8:31:39 | comment | LGTM[go/redundant-assignment] | LGTM[go/redundant-assignment] | tst.go:31:1:31:39 | suppression range | -| tst.go:32:8:32:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-assignment] | tst.go:32:1:32:72 | suppression range | -| tst.go:32:8:32:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-operation] | tst.go:32:1:32:72 | suppression range | -| tst.go:33:8:33:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm | tst.go:33:1:33:45 | suppression range | -| tst.go:33:8:33:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm[go/redundant-assignment] | tst.go:33:1:33:45 | suppression range | -| tst.go:34:8:34:19 | comment | lgtm[] | lgtm[] | tst.go:34:1:34:19 | suppression range | -| tst.go:35:8:35:42 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:35:1:35:42 | suppression range | -| tst.go:41:8:41:56 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tst.go:41:1:41:56 | suppression range | -| tst.go:42:8:42:32 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tst.go:42:1:42:32 | suppression range | -| tstWindows.go:5:8:5:14 | comment | lgtm | lgtm | tstWindows.go:5:1:5:14 | suppression range | -| tstWindows.go:6:8:6:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:6:1:6:39 | suppression range | -| tstWindows.go:7:8:7:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:7:1:7:39 | suppression range | -| tstWindows.go:8:8:8:63 | comment | lgtm[go/redundant-assignment, go/redundant-operation] | lgtm[go/redundant-assignment, go/redundant-operation] | tstWindows.go:8:1:8:63 | suppression range | -| tstWindows.go:9:8:9:29 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tstWindows.go:9:1:9:29 | suppression range | -| tstWindows.go:10:8:10:53 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tstWindows.go:10:1:10:53 | suppression range | -| tstWindows.go:11:8:11:35 | comment | lgtm[@expires:2017-06-11] | lgtm[@expires:2017-06-11] | tstWindows.go:11:1:11:35 | suppression range | -| tstWindows.go:12:8:12:70 | comment | lgtm[go/redundant-operation] because I know better than lgtm | lgtm[go/redundant-operation] | tstWindows.go:12:1:12:70 | suppression range | -| tstWindows.go:13:8:13:25 | comment | lgtm: blah blah | lgtm | tstWindows.go:13:1:13:25 | suppression range | -| tstWindows.go:14:8:14:39 | comment | lgtm blah blah #falsepositive | lgtm | tstWindows.go:14:1:14:39 | suppression range | -| tstWindows.go:15:8:15:39 | comment | lgtm [go/redundant-operation] | lgtm [go/redundant-operation] | tstWindows.go:15:1:15:39 | suppression range | -| tstWindows.go:16:8:16:17 | comment | lgtm | lgtm | tstWindows.go:16:1:16:17 | suppression range | -| tstWindows.go:17:8:17:16 | comment | lgtm[] | lgtm[] | tstWindows.go:17:1:17:16 | suppression range | -| tstWindows.go:19:8:19:13 | comment | lgtm | lgtm | tstWindows.go:19:1:19:13 | suppression range | -| tstWindows.go:20:8:20:14 | comment | \tlgtm | lgtm | tstWindows.go:20:1:20:14 | suppression range | -| tstWindows.go:21:8:21:40 | comment | lgtm\t[go/redundant-assignment] | lgtm\t[go/redundant-assignment] | tstWindows.go:21:1:21:40 | suppression range | -| tstWindows.go:24:8:24:19 | comment | foo; lgtm | lgtm | tstWindows.go:24:1:24:19 | suppression range | -| tstWindows.go:25:8:25:44 | comment | foo; lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:25:1:25:44 | suppression range | -| tstWindows.go:27:8:27:43 | comment | foo lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:27:1:27:43 | suppression range | -| tstWindows.go:29:8:29:47 | comment | foo lgtm[go/redundant-assignment] bar | lgtm[go/redundant-assignment] | tstWindows.go:29:1:29:47 | suppression range | -| tstWindows.go:30:8:30:15 | comment | LGTM! | LGTM | tstWindows.go:30:1:30:15 | suppression range | -| tstWindows.go:31:8:31:39 | comment | LGTM[go/redundant-assignment] | LGTM[go/redundant-assignment] | tstWindows.go:31:1:31:39 | suppression range | -| tstWindows.go:32:8:32:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-assignment] | tstWindows.go:32:1:32:72 | suppression range | -| tstWindows.go:32:8:32:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-operation] | tstWindows.go:32:1:32:72 | suppression range | -| tstWindows.go:33:8:33:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm | tstWindows.go:33:1:33:45 | suppression range | -| tstWindows.go:33:8:33:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm[go/redundant-assignment] | tstWindows.go:33:1:33:45 | suppression range | -| tstWindows.go:34:8:34:19 | comment | lgtm[] | lgtm[] | tstWindows.go:34:1:34:19 | suppression range | -| tstWindows.go:35:8:35:42 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:35:1:35:42 | suppression range | -| tstWindows.go:41:8:41:56 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tstWindows.go:41:1:41:56 | suppression range | -| tstWindows.go:42:8:42:32 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tstWindows.go:42:1:42:32 | suppression range | +| tst.go:7:8:7:14 | comment | lgtm | lgtm | tst.go:7:1:7:14 | suppression range | +| tst.go:8:8:8:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:8:1:8:39 | suppression range | +| tst.go:9:8:9:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:9:1:9:39 | suppression range | +| tst.go:10:8:10:63 | comment | lgtm[go/redundant-assignment, go/redundant-operation] | lgtm[go/redundant-assignment, go/redundant-operation] | tst.go:10:1:10:63 | suppression range | +| tst.go:11:8:11:29 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tst.go:11:1:11:29 | suppression range | +| tst.go:12:8:12:53 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tst.go:12:1:12:53 | suppression range | +| tst.go:13:8:13:35 | comment | lgtm[@expires:2017-06-11] | lgtm[@expires:2017-06-11] | tst.go:13:1:13:35 | suppression range | +| tst.go:14:8:14:70 | comment | lgtm[go/redundant-operation] because I know better than lgtm | lgtm[go/redundant-operation] | tst.go:14:1:14:70 | suppression range | +| tst.go:15:8:15:25 | comment | lgtm: blah blah | lgtm | tst.go:15:1:15:25 | suppression range | +| tst.go:16:8:16:39 | comment | lgtm blah blah #falsepositive | lgtm | tst.go:16:1:16:39 | suppression range | +| tst.go:17:8:17:39 | comment | lgtm [go/redundant-operation] | lgtm [go/redundant-operation] | tst.go:17:1:17:39 | suppression range | +| tst.go:18:8:18:17 | comment | lgtm | lgtm | tst.go:18:1:18:17 | suppression range | +| tst.go:19:8:19:16 | comment | lgtm[] | lgtm[] | tst.go:19:1:19:16 | suppression range | +| tst.go:21:8:21:13 | comment | lgtm | lgtm | tst.go:21:1:21:13 | suppression range | +| tst.go:22:8:22:14 | comment | \tlgtm | lgtm | tst.go:22:1:22:14 | suppression range | +| tst.go:23:8:23:40 | comment | lgtm\t[go/redundant-assignment] | lgtm\t[go/redundant-assignment] | tst.go:23:1:23:40 | suppression range | +| tst.go:26:8:26:19 | comment | foo; lgtm | lgtm | tst.go:26:1:26:19 | suppression range | +| tst.go:27:8:27:44 | comment | foo; lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:27:1:27:44 | suppression range | +| tst.go:29:8:29:43 | comment | foo lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:29:1:29:43 | suppression range | +| tst.go:31:8:31:47 | comment | foo lgtm[go/redundant-assignment] bar | lgtm[go/redundant-assignment] | tst.go:31:1:31:47 | suppression range | +| tst.go:32:8:32:15 | comment | LGTM! | LGTM | tst.go:32:1:32:15 | suppression range | +| tst.go:33:8:33:39 | comment | LGTM[go/redundant-assignment] | LGTM[go/redundant-assignment] | tst.go:33:1:33:39 | suppression range | +| tst.go:34:8:34:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-assignment] | tst.go:34:1:34:72 | suppression range | +| tst.go:34:8:34:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-operation] | tst.go:34:1:34:72 | suppression range | +| tst.go:35:8:35:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm | tst.go:35:1:35:45 | suppression range | +| tst.go:35:8:35:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm[go/redundant-assignment] | tst.go:35:1:35:45 | suppression range | +| tst.go:36:8:36:19 | comment | lgtm[] | lgtm[] | tst.go:36:1:36:19 | suppression range | +| tst.go:37:8:37:42 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tst.go:37:1:37:42 | suppression range | +| tst.go:43:8:43:56 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tst.go:43:1:43:56 | suppression range | +| tst.go:44:8:44:32 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tst.go:44:1:44:32 | suppression range | +| tstWindows.go:7:8:7:14 | comment | lgtm | lgtm | tstWindows.go:7:1:7:14 | suppression range | +| tstWindows.go:8:8:8:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:8:1:8:39 | suppression range | +| tstWindows.go:9:8:9:39 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:9:1:9:39 | suppression range | +| tstWindows.go:10:8:10:63 | comment | lgtm[go/redundant-assignment, go/redundant-operation] | lgtm[go/redundant-assignment, go/redundant-operation] | tstWindows.go:10:1:10:63 | suppression range | +| tstWindows.go:11:8:11:29 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tstWindows.go:11:1:11:29 | suppression range | +| tstWindows.go:12:8:12:53 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tstWindows.go:12:1:12:53 | suppression range | +| tstWindows.go:13:8:13:35 | comment | lgtm[@expires:2017-06-11] | lgtm[@expires:2017-06-11] | tstWindows.go:13:1:13:35 | suppression range | +| tstWindows.go:14:8:14:70 | comment | lgtm[go/redundant-operation] because I know better than lgtm | lgtm[go/redundant-operation] | tstWindows.go:14:1:14:70 | suppression range | +| tstWindows.go:15:8:15:25 | comment | lgtm: blah blah | lgtm | tstWindows.go:15:1:15:25 | suppression range | +| tstWindows.go:16:8:16:39 | comment | lgtm blah blah #falsepositive | lgtm | tstWindows.go:16:1:16:39 | suppression range | +| tstWindows.go:17:8:17:39 | comment | lgtm [go/redundant-operation] | lgtm [go/redundant-operation] | tstWindows.go:17:1:17:39 | suppression range | +| tstWindows.go:18:8:18:17 | comment | lgtm | lgtm | tstWindows.go:18:1:18:17 | suppression range | +| tstWindows.go:19:8:19:16 | comment | lgtm[] | lgtm[] | tstWindows.go:19:1:19:16 | suppression range | +| tstWindows.go:21:8:21:13 | comment | lgtm | lgtm | tstWindows.go:21:1:21:13 | suppression range | +| tstWindows.go:22:8:22:14 | comment | \tlgtm | lgtm | tstWindows.go:22:1:22:14 | suppression range | +| tstWindows.go:23:8:23:40 | comment | lgtm\t[go/redundant-assignment] | lgtm\t[go/redundant-assignment] | tstWindows.go:23:1:23:40 | suppression range | +| tstWindows.go:26:8:26:19 | comment | foo; lgtm | lgtm | tstWindows.go:26:1:26:19 | suppression range | +| tstWindows.go:27:8:27:44 | comment | foo; lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:27:1:27:44 | suppression range | +| tstWindows.go:29:8:29:43 | comment | foo lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:29:1:29:43 | suppression range | +| tstWindows.go:31:8:31:47 | comment | foo lgtm[go/redundant-assignment] bar | lgtm[go/redundant-assignment] | tstWindows.go:31:1:31:47 | suppression range | +| tstWindows.go:32:8:32:15 | comment | LGTM! | LGTM | tstWindows.go:32:1:32:15 | suppression range | +| tstWindows.go:33:8:33:39 | comment | LGTM[go/redundant-assignment] | LGTM[go/redundant-assignment] | tstWindows.go:33:1:33:39 | suppression range | +| tstWindows.go:34:8:34:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-assignment] | tstWindows.go:34:1:34:72 | suppression range | +| tstWindows.go:34:8:34:72 | comment | lgtm[go/redundant-assignment] and lgtm[go/redundant-operation] | lgtm[go/redundant-operation] | tstWindows.go:34:1:34:72 | suppression range | +| tstWindows.go:35:8:35:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm | tstWindows.go:35:1:35:45 | suppression range | +| tstWindows.go:35:8:35:45 | comment | lgtm[go/redundant-assignment]; lgtm | lgtm[go/redundant-assignment] | tstWindows.go:35:1:35:45 | suppression range | +| tstWindows.go:36:8:36:19 | comment | lgtm[] | lgtm[] | tstWindows.go:36:1:36:19 | suppression range | +| tstWindows.go:37:8:37:42 | comment | lgtm[go/redundant-assignment] | lgtm[go/redundant-assignment] | tstWindows.go:37:1:37:42 | suppression range | +| tstWindows.go:43:8:43:56 | comment | lgtm[@tag:nullness,go/redundant-assignment] | lgtm[@tag:nullness,go/redundant-assignment] | tstWindows.go:43:1:43:56 | suppression range | +| tstWindows.go:44:8:44:32 | comment | lgtm[@tag:nullness] | lgtm[@tag:nullness] | tstWindows.go:44:1:44:32 | suppression range | diff --git a/ql/test/query-tests/AlertSuppression/tst.go b/ql/test/query-tests/AlertSuppression/tst.go index 4f6fab4a538..4e0ef811e49 100644 --- a/ql/test/query-tests/AlertSuppression/tst.go +++ b/ql/test/query-tests/AlertSuppression/tst.go @@ -1,5 +1,7 @@ package main +// autoformat-ignore (avoid gofmt changing line-endings, which should be specifically LFs here) + func main() { x := 42 x = x // lgtm diff --git a/ql/test/query-tests/AlertSuppression/tstWindows.go b/ql/test/query-tests/AlertSuppression/tstWindows.go index 764938f4d06..93baea9ba3b 100644 --- a/ql/test/query-tests/AlertSuppression/tstWindows.go +++ b/ql/test/query-tests/AlertSuppression/tstWindows.go @@ -1,5 +1,7 @@ package main +// autoformat-ignore (otherwise gofmt will replace CRLF line-endings with LFs under Unix-like environments) + func winMain() { x := 42 x = x // lgtm diff --git a/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.expected b/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.expected index dc3b7057b8a..c9c91c4d397 100644 --- a/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.expected +++ b/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.expected @@ -1,2 +1,2 @@ -| WhitespaceContradictsPrecedence.go:4:9:4:18 | ...<<... | & is evaluated before <<, but whitespace suggests the opposite. | -| main.go:12:9:12:16 | ...+... | >> is evaluated before +, but whitespace suggests the opposite. | +| WhitespaceContradictsPrecedence.go:6:9:6:18 | ...<<... | & is evaluated before <<, but whitespace suggests the opposite. | +| main.go:14:9:14:16 | ...+... | >> is evaluated before +, but whitespace suggests the opposite. | diff --git a/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.go b/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.go index 462cc8b7377..ee6987ec931 100644 --- a/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.go +++ b/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/WhitespaceContradictsPrecedence.go @@ -1,5 +1,7 @@ package main +// autoformat-ignore (otherwise gofmt will fix the spacing to reflect precedence) + func isBitSetBad(x int, pos uint) bool { return x & 1<>1; + return x + x>>1; } func ok2(x int) int { - return x + x >> 1; + return x + x >> 1; } func bad(x int) int { - return x+x >> 1; + return x+x >> 1; } func ok3(x int) int { - return x + (x>>1); + return x + (x>>1); } func ok4(x int, y int, z int) int { @@ -25,13 +27,13 @@ func ok5(x int, y int, z int) int { } func ok6(x int) int { - return x + x>> 1; + return x + x>> 1; } func ok7(x int, y int, z int) int { return x + y - z; } - + func ok8(x int, y int, z int) int { return x + y-z; }