diff --git a/ql/test/consistency/CONSISTENCY/UnexpectedFrontendErrors.expected b/ql/test/consistency/CONSISTENCY/UnexpectedFrontendErrors.expected new file mode 100644 index 00000000000..4c318786b77 --- /dev/null +++ b/ql/test/consistency/CONSISTENCY/UnexpectedFrontendErrors.expected @@ -0,0 +1 @@ +| test.go:7:1:7:1 | expected declaration, found This | diff --git a/ql/test/consistency/UnexpectedFrontendErrors.expected b/ql/test/consistency/UnexpectedFrontendErrors.expected index e69de29bb2d..4c318786b77 100644 --- a/ql/test/consistency/UnexpectedFrontendErrors.expected +++ b/ql/test/consistency/UnexpectedFrontendErrors.expected @@ -0,0 +1 @@ +| test.go:7:1:7:1 | expected declaration, found This | diff --git a/ql/test/consistency/UnexpectedFrontendErrors.ql b/ql/test/consistency/UnexpectedFrontendErrors.ql index f75e2c6bf21..c447c498288 100644 --- a/ql/test/consistency/UnexpectedFrontendErrors.ql +++ b/ql/test/consistency/UnexpectedFrontendErrors.ql @@ -1,16 +1,11 @@ /** * @name Unexpected frontend error * @description This query produces a list of all errors produced by the Go frontend - * during extraction, except for those occurring in files annotated with - * "// codeql test: expect frontend errors". + * during extraction. * @id go/unexpected-frontend-error */ import go from Error e -where - not exists(Comment c | c.getFile() = e.getFile() | - c.getText().trim() = "codeql test: expect frontend errors" - ) select e diff --git a/ql/test/consistency/test.go b/ql/test/consistency/test.go index 68b7721f3ef..e641c4240a9 100644 --- a/ql/test/consistency/test.go +++ b/ql/test/consistency/test.go @@ -2,8 +2,6 @@ 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 +// Example file with a syntax error to demonstrate use of consistency queries This is not a valid Go program diff --git a/ql/test/library-tests/semmle/go/Types/CONSISTENCY/UnexpectedFrontendErrors.expected b/ql/test/library-tests/semmle/go/Types/CONSISTENCY/UnexpectedFrontendErrors.expected new file mode 100644 index 00000000000..fa64f5084a9 --- /dev/null +++ b/ql/test/library-tests/semmle/go/Types/CONSISTENCY/UnexpectedFrontendErrors.expected @@ -0,0 +1 @@ +| unknownFunction.go:9:7:9:7 | undeclared name: unknownFunction | diff --git a/ql/test/library-tests/semmle/go/Types/SignatureType_getNumParameter.expected b/ql/test/library-tests/semmle/go/Types/SignatureType_getNumParameter.expected index 0df6274ef7d..84df8997f90 100644 --- a/ql/test/library-tests/semmle/go/Types/SignatureType_getNumParameter.expected +++ b/ql/test/library-tests/semmle/go/Types/SignatureType_getNumParameter.expected @@ -9,4 +9,4 @@ | pkg1/tst.go:33:1:35:1 | function declaration | 0 | | pkg1/tst.go:37:1:37:26 | function declaration | 1 | | pkg1/tst.go:39:1:57:1 | function declaration | 2 | -| unknownFunction.go:10:1:14:1 | function declaration | 0 | +| unknownFunction.go:8:1:12:1 | function declaration | 0 | diff --git a/ql/test/library-tests/semmle/go/Types/SignatureType_getNumResult.expected b/ql/test/library-tests/semmle/go/Types/SignatureType_getNumResult.expected index 298e6015dc4..2abef7b7e65 100644 --- a/ql/test/library-tests/semmle/go/Types/SignatureType_getNumResult.expected +++ b/ql/test/library-tests/semmle/go/Types/SignatureType_getNumResult.expected @@ -9,4 +9,4 @@ | pkg1/tst.go:33:1:35:1 | function declaration | 1 | | pkg1/tst.go:37:1:37:26 | function declaration | 0 | | pkg1/tst.go:39:1:57:1 | function declaration | 0 | -| unknownFunction.go:10:1:14:1 | function declaration | 0 | +| unknownFunction.go:8:1:12:1 | function declaration | 0 | diff --git a/ql/test/library-tests/semmle/go/Types/notype.expected b/ql/test/library-tests/semmle/go/Types/notype.expected index ded6be7bc59..669165864d4 100644 --- a/ql/test/library-tests/semmle/go/Types/notype.expected +++ b/ql/test/library-tests/semmle/go/Types/notype.expected @@ -1,3 +1,3 @@ -| unknownFunction.go:11:7:11:21 | unknownFunction | invalid type | -| unknownFunction.go:11:7:11:23 | call to unknownFunction | invalid type | -| unknownFunction.go:12:7:12:15 | ...+... | invalid type | +| unknownFunction.go:9:7:9:21 | unknownFunction | invalid type | +| unknownFunction.go:9:7:9:23 | call to unknownFunction | invalid type | +| unknownFunction.go:10:7:10:15 | ...+... | invalid type | diff --git a/ql/test/library-tests/semmle/go/Types/unknownFunction.go b/ql/test/library-tests/semmle/go/Types/unknownFunction.go index 1eda1dba942..e06c2469757 100644 --- a/ql/test/library-tests/semmle/go/Types/unknownFunction.go +++ b/ql/test/library-tests/semmle/go/Types/unknownFunction.go @@ -1,9 +1,7 @@ package main // This file tests type inference for expressions referencing undeclared entities. -// It is therefore expected to expected frontend errors. - -// codeql test: expect frontend errors +// It is therefore expected to produce frontend errors. import "fmt" diff --git a/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/CONSISTENCY/UnexpectedFrontendErrors.expected b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/CONSISTENCY/UnexpectedFrontendErrors.expected new file mode 100644 index 00000000000..13fa384da0e --- /dev/null +++ b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/CONSISTENCY/UnexpectedFrontendErrors.expected @@ -0,0 +1 @@ +| main.go:36:9:36:9 | undeclared name: unknownFunction | diff --git a/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected index 58fd429b859..b646631be51 100644 --- a/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected +++ b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected @@ -1,4 +1,4 @@ -| main.go:27:2:27:2 | assignment to x | This definition of x is never used. | +| main.go:25:2:25:2 | assignment to x | This definition of x is never used. | | testdata.go:32:2:32:2 | assignment to x | This definition of x is never used. | | testdata.go:37:2:37:2 | assignment to x | This definition of x is never used. | | testdata.go:61:2:61:2 | assignment to x | This definition of x is never used. | diff --git a/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/main.go b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/main.go index 05cad065d61..31062a18f98 100644 --- a/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/main.go +++ b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/main.go @@ -2,8 +2,6 @@ package p import "fmt" -// codeql test: expect frontend errors - func test() { if false { x := deadStore() // OK diff --git a/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/CONSISTENCY/UnexpectedFrontendErrors.expected b/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/CONSISTENCY/UnexpectedFrontendErrors.expected new file mode 100644 index 00000000000..f0a094c5bab --- /dev/null +++ b/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/CONSISTENCY/UnexpectedFrontendErrors.expected @@ -0,0 +1 @@ +| err.go:6:7:6:7 | undeclared name: unknownFunction | diff --git a/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/err.go b/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/err.go index 034b34b3d67..8801b3b7465 100644 --- a/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/err.go +++ b/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/err.go @@ -2,8 +2,6 @@ package main import "fmt" -// codeql test: expect frontend errors - func errtest() { x := unknownFunction() var y interface{} = x