diff --git a/test/fixedbugs/bug176.go b/test/fixedbugs/bug176.go index 7001dd081e..61e63c7656 100644 --- a/test/fixedbugs/bug176.go +++ b/test/fixedbugs/bug176.go @@ -8,7 +8,6 @@ package main var x int -var a = []int{ x: 1} // ERROR "constant" -var b = [...]int{x: 1} // GCCGO_ERROR "constant" -var c = map[int]int{ x: 1} - +var a = []int{x: 1} // ERROR "constant" +var b = [...]int{x: 1} // ERROR "constant" +var c = map[int]int{x: 1} diff --git a/test/fixedbugs/bug195.go b/test/fixedbugs/bug195.go index 6d8578d6cb..4a3bf0db81 100644 --- a/test/fixedbugs/bug195.go +++ b/test/fixedbugs/bug195.go @@ -11,14 +11,14 @@ type I2 int type I3 interface{ int } // ERROR "interface" -type S struct { - x interface{ S } // ERROR "interface" +type S struct { // GC_ERROR "invalid recursive type" + x interface{ S } // GCCGO_ERROR "interface" } -type I4 interface { // GC_ERROR "invalid recursive type I4\n\tLINE: I4 refers to\n\tLINE: I4$" +type I4 interface { // GC_ERROR "invalid recursive type I4\n\tLINE:.* I4 refers to\n\tLINE:.* I4$" I4 // GCCGO_ERROR "interface" } -type I5 interface { // GC_ERROR "invalid recursive type I5\n\tLINE: I5 refers to\n\tLINE+4: I6 refers to\n\tLINE: I5$" +type I5 interface { // GC_ERROR "invalid recursive type I5\n\tLINE:.* I5 refers to\n\tLINE+4:.* I6 refers to\n\tLINE:.* I5$" I6 } diff --git a/test/fixedbugs/bug228.go b/test/fixedbugs/bug228.go index 50e895917f..5c0e7e5122 100644 --- a/test/fixedbugs/bug228.go +++ b/test/fixedbugs/bug228.go @@ -6,14 +6,10 @@ package main -func f(x int, y ...int) // ok +func f(x int, y ...int) // ok func g(x int, y float32) (...) // ERROR "[.][.][.]" -func h(x, y ...int) // ERROR "[.][.][.]" - -func i(x int, y ...int, z float32) // ERROR "[.][.][.]" - var x ...int; // ERROR "[.][.][.]|syntax|type" type T ...int; // ERROR "[.][.][.]|syntax|type" diff --git a/test/fixedbugs/bug228a.go b/test/fixedbugs/bug228a.go new file mode 100644 index 0000000000..c42b0bffb7 --- /dev/null +++ b/test/fixedbugs/bug228a.go @@ -0,0 +1,13 @@ +// errorcheck + +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +func f(x int, y ...int) // ok + +func h(x, y ...int) // ERROR "[.][.][.]" + +func i(x int, y ...int, z float32) // ERROR "[.][.][.]" diff --git a/test/fixedbugs/bug231.go b/test/fixedbugs/bug231.go index f64ddc3e75..db0d536db7 100644 --- a/test/fixedbugs/bug231.go +++ b/test/fixedbugs/bug231.go @@ -6,17 +6,19 @@ package main -type I interface { m() } -type T struct { m func() } -type M struct {} +type I interface{ m() } +type T struct{ m func() } +type M struct{} + func (M) m() {} func main() { var t T var m M var i I - + i = m - i = t // ERROR "not a method|has no methods" "does not implement I" + // types2 does not give extra error "T.m is a field, not a method" + i = t // ERROR "not a method|has no methods|does not implement I" _ = i } diff --git a/test/fixedbugs/bug255.go b/test/fixedbugs/bug255.go index 458fb972b2..38df7813c9 100644 --- a/test/fixedbugs/bug255.go +++ b/test/fixedbugs/bug255.go @@ -8,13 +8,13 @@ package main var a [10]int // ok var b [1e1]int // ok -var c [1.5]int // ERROR "truncated" -var d ["abc"]int // ERROR "invalid array bound|not numeric" -var e [nil]int // ERROR "use of untyped nil|invalid array bound|not numeric" +var c [1.5]int // ERROR "truncated|must be integer" +var d ["abc"]int // ERROR "invalid array bound|not numeric|must be integer" +var e [nil]int // ERROR "use of untyped nil|invalid array bound|not numeric|must be constant" var f [e]int // ok: error already reported for e -var g [1 << 65]int // ERROR "array bound is too large|overflows" +var g [1 << 65]int // ERROR "array bound is too large|overflows|must be integer" var h [len(a)]int // ok func ff() string -var i [len([1]string{ff()})]int // ERROR "non-constant array bound|not constant" +var i [len([1]string{ff()})]int // ERROR "non-constant array bound|not constant|must be constant" diff --git a/test/fixedbugs/bug388.go b/test/fixedbugs/bug388.go index 2d508501e0..a060c9fd5a 100644 --- a/test/fixedbugs/bug388.go +++ b/test/fixedbugs/bug388.go @@ -13,16 +13,6 @@ func foo(runtime.UintType, i int) { // ERROR "cannot declare name runtime.UintT println(i, runtime.UintType) // GCCGO_ERROR "undefined identifier" } -func bar(i int) { - runtime.UintType := i // ERROR "non-name runtime.UintType|non-name on left side|undefined identifier" - println(runtime.UintType) // GCCGO_ERROR "invalid use of type|undefined identifier" -} - -func baz() { - main.i := 1 // ERROR "non-name main.i|non-name on left side" - println(main.i) // GCCGO_ERROR "no fields or methods" -} - func qux() { var main.i // ERROR "unexpected [.]|expected type" println(main.i) diff --git a/test/fixedbugs/bug388a.go b/test/fixedbugs/bug388a.go new file mode 100644 index 0000000000..fca6d9c1e4 --- /dev/null +++ b/test/fixedbugs/bug388a.go @@ -0,0 +1,23 @@ +// errorcheck + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issue 2231 + +package main +import "runtime" + +func bar(i int) { + runtime.UintType := i // ERROR "non-name runtime.UintType|non-name on left side|undefined" + println(runtime.UintType) // ERROR "invalid use of type|undefined" +} + +func baz() { + main.i := 1 // ERROR "non-name main.i|non-name on left side|undefined" + println(main.i) // ERROR "no fields or methods|undefined" +} + +func main() { +} diff --git a/test/fixedbugs/bug412.go b/test/fixedbugs/bug412.go index 183fb7e4af..26ac45fbb4 100644 --- a/test/fixedbugs/bug412.go +++ b/test/fixedbugs/bug412.go @@ -7,10 +7,10 @@ package p type t struct { - x int // GCCGO_ERROR "duplicate field name .x." - x int // GC_ERROR "duplicate field x" + x int // GCCGO_ERROR "duplicate field name .x." + x int // GC_ERROR "duplicate field x|x redeclared" } func f(t *t) int { - return t.x // GC_ERROR "ambiguous selector t.x" + return t.x } diff --git a/test/fixedbugs/issue11590.go b/test/fixedbugs/issue11590.go index f2a955f96d..9f89783343 100644 --- a/test/fixedbugs/issue11590.go +++ b/test/fixedbugs/issue11590.go @@ -6,6 +6,6 @@ package p -var _ = int8(4) * 300 // ERROR "constant 300 overflows int8" "constant 1200 overflows int8|integer constant overflow" -var _ = complex64(1) * 1e200 // ERROR "constant 1e\+200 overflows complex64|complex real part overflow" -var _ = complex128(1) * 1e500 // ERROR "constant 1e\+500 overflows complex128|complex real part overflow" +var _ = int8(4) * 300 // ERROR "overflows int8" +var _ = complex64(1) * 1e200 // ERROR "complex real part overflow|overflows complex64" +var _ = complex128(1) * 1e500 // ERROR "complex real part overflow|overflows complex128" diff --git a/test/fixedbugs/issue11610.go b/test/fixedbugs/issue11610.go index 7ebfae6709..8d68c98f2d 100644 --- a/test/fixedbugs/issue11610.go +++ b/test/fixedbugs/issue11610.go @@ -8,7 +8,6 @@ // following an empty import. package a -import"" // ERROR "import path is empty" var? // ERROR "invalid character U\+003F '\?'|invalid character 0x3f in input file" var x int // ERROR "unexpected var|expected identifier|expected type" diff --git a/test/fixedbugs/issue11610a.go b/test/fixedbugs/issue11610a.go new file mode 100644 index 0000000000..bbf60b6b04 --- /dev/null +++ b/test/fixedbugs/issue11610a.go @@ -0,0 +1,11 @@ +// errorcheck + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Test an internal compiler error on ? symbol in declaration +// following an empty import. + +package a +import"" // ERROR "import path is empty|invalid import path \(empty string\)" diff --git a/test/fixedbugs/issue11614.go b/test/fixedbugs/issue11614.go index 6ea463b7fe..e8d6badfb9 100644 --- a/test/fixedbugs/issue11614.go +++ b/test/fixedbugs/issue11614.go @@ -11,15 +11,15 @@ package main type I interface { - int // ERROR "interface contains embedded non-interface" + int // ERROR "interface contains embedded non-interface|embedding non-interface type int requires" } func n() { - (I) + (I) // GC_ERROR "is not an expression" } func m() { - (interface{int}) // ERROR "interface contains embedded non-interface" "type interface { int } is not an expression" + (interface{int}) // ERROR "interface contains embedded non-interface|embedding non-interface type int requires" "type interface { int } is not an expression|\(interface{int}\) \(type\) is not an expression" } func main() { diff --git a/test/fixedbugs/issue14520.go b/test/fixedbugs/issue14520.go index 0b840ff4be..29cc270deb 100644 --- a/test/fixedbugs/issue14520.go +++ b/test/fixedbugs/issue14520.go @@ -6,9 +6,6 @@ package f -import /* // ERROR "import path" */ ` -bogus` - func f(x int /* // GC_ERROR "unexpected newline" */) // GCCGO_ERROR "expected .*\).*|expected declaration" diff --git a/test/fixedbugs/issue14520a.go b/test/fixedbugs/issue14520a.go new file mode 100644 index 0000000000..bb45d7e186 --- /dev/null +++ b/test/fixedbugs/issue14520a.go @@ -0,0 +1,10 @@ +// errorcheck + +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package f + +import /* // ERROR "import path" */ ` +bogus` diff --git a/test/fixedbugs/issue17038.go b/test/fixedbugs/issue17038.go index 4d7422c60c..1b65ffc1f0 100644 --- a/test/fixedbugs/issue17038.go +++ b/test/fixedbugs/issue17038.go @@ -6,4 +6,4 @@ package main -const A = complex(0()) // ERROR "cannot call non-function" "not enough arguments" +const A = complex(0()) // ERROR "cannot call non-function" diff --git a/test/fixedbugs/issue19012.go b/test/fixedbugs/issue19012.go index 158618aa27..77b2236063 100644 --- a/test/fixedbugs/issue19012.go +++ b/test/fixedbugs/issue19012.go @@ -13,9 +13,9 @@ package main func f(x int, y uint) { if true { - return "a" > 10 // ERROR "^too many arguments to return$|return with value in function with no return|mismatched types" + return "a" > 10 // ERROR "^too many arguments to return$|return with value in function with no return|no result values expected|mismatched types" } - return "gopher" == true, 10 // ERROR "^too many arguments to return$|return with value in function with no return|mismatched types" + return "gopher" == true, 10 // ERROR "^too many arguments to return$|return with value in function with no return|no result values expected|mismatched types" } func main() { diff --git a/test/fixedbugs/issue21979.go b/test/fixedbugs/issue21979.go index addf786c03..c6575a3928 100644 --- a/test/fixedbugs/issue21979.go +++ b/test/fixedbugs/issue21979.go @@ -7,39 +7,40 @@ package p func f() { - _ = bool("") // ERROR "cannot convert .. \(type untyped string\) to type bool|invalid type conversion" - _ = bool(1) // ERROR "cannot convert 1 \(type untyped int\) to type bool|invalid type conversion" - _ = bool(1.0) // ERROR "cannot convert 1 \(type untyped float\) to type bool|invalid type conversion" - _ = bool(-4 + 2i) // ERROR "cannot convert -4 \+ 2i \(type untyped complex\) to type bool|invalid type conversion" + _ = bool("") // ERROR "cannot convert .. \(.*untyped string.*\) to type bool|invalid type conversion" + _ = bool(1) // ERROR "cannot convert 1 \(.*untyped int.*\) to type bool|invalid type conversion" + _ = bool(1.0) // ERROR "cannot convert 1.* \(.*untyped float.*\) to type bool|invalid type conversion" + _ = bool(-4 + 2i) // ERROR "cannot convert -4 \+ 2i \(.*untyped complex.*\) to type bool|invalid type conversion" - _ = string(true) // ERROR "cannot convert true \(type untyped bool\) to type string|invalid type conversion" + _ = string(true) // ERROR "cannot convert true \(.*untyped bool.*\) to type string|invalid type conversion" _ = string(-1) - _ = string(1.0) // ERROR "cannot convert 1 \(type untyped float\) to type string|invalid type conversion" - _ = string(-4 + 2i) // ERROR "cannot convert -4 \+ 2i \(type untyped complex\) to type string|invalid type conversion" + _ = string(1.0) // ERROR "cannot convert 1.* \(.*untyped float.*\) to type string|invalid type conversion" + _ = string(-4 + 2i) // ERROR "cannot convert -4 \+ 2i \(.*untyped complex.*\) to type string|invalid type conversion" - _ = int("") // ERROR "cannot convert .. \(type untyped string\) to type int|invalid type conversion" - _ = int(true) // ERROR "cannot convert true \(type untyped bool\) to type int|invalid type conversion" + _ = int("") // ERROR "cannot convert .. \(.*untyped string.*\) to type int|invalid type conversion" + _ = int(true) // ERROR "cannot convert true \(.*untyped bool.*\) to type int|invalid type conversion" _ = int(-1) _ = int(1) _ = int(1.0) - _ = int(-4 + 2i) // ERROR "truncated to integer" + _ = int(-4 + 2i) // ERROR "truncated to integer|cannot convert -4 \+ 2i \(.*untyped complex.*\) to type int" - _ = uint("") // ERROR "cannot convert .. \(type untyped string\) to type uint|invalid type conversion" - _ = uint(true) // ERROR "cannot convert true \(type untyped bool\) to type uint|invalid type conversion" - _ = uint(-1) // ERROR "constant -1 overflows uint|integer constant overflow" + _ = uint("") // ERROR "cannot convert .. \(.*untyped string.*\) to type uint|invalid type conversion" + _ = uint(true) // ERROR "cannot convert true \(.*untyped bool.*\) to type uint|invalid type conversion" + _ = uint(-1) // ERROR "constant -1 overflows uint|integer constant overflow|cannot convert -1 \(untyped int constant\) to type uint" _ = uint(1) _ = uint(1.0) - _ = uint(-4 + 2i) // ERROR "constant -4 overflows uint" "truncated to integer" + // types1 reports extra error "truncated to integer" + _ = uint(-4 + 2i) // ERROR "constant -4 overflows uint|truncated to integer|cannot convert -4 \+ 2i \(untyped complex constant.*\) to type uint" - _ = float64("") // ERROR "cannot convert .. \(type untyped string\) to type float64|invalid type conversion" - _ = float64(true) // ERROR "cannot convert true \(type untyped bool\) to type float64|invalid type conversion" + _ = float64("") // ERROR "cannot convert .. \(.*untyped string.*\) to type float64|invalid type conversion" + _ = float64(true) // ERROR "cannot convert true \(.*untyped bool.*\) to type float64|invalid type conversion" _ = float64(-1) _ = float64(1) _ = float64(1.0) - _ = float64(-4 + 2i) // ERROR "truncated to" + _ = float64(-4 + 2i) // ERROR "truncated to|cannot convert -4 \+ 2i \(.*untyped complex.*\) to type float64" - _ = complex128("") // ERROR "cannot convert .. \(type untyped string\) to type complex128|invalid type conversion" - _ = complex128(true) // ERROR "cannot convert true \(type untyped bool\) to type complex128|invalid type conversion" + _ = complex128("") // ERROR "cannot convert .. \(.*untyped string.*\) to type complex128|invalid type conversion" + _ = complex128(true) // ERROR "cannot convert true \(.*untyped bool.*\) to type complex128|invalid type conversion" _ = complex128(-1) _ = complex128(1) _ = complex128(1.0) diff --git a/test/fixedbugs/issue23732.go b/test/fixedbugs/issue23732.go index db2d182234..79b60e26df 100644 --- a/test/fixedbugs/issue23732.go +++ b/test/fixedbugs/issue23732.go @@ -24,19 +24,19 @@ func main() { _ = Foo{ // GCCGO_ERROR "too few expressions" 1, 2, - 3, // GC_ERROR "too few values in Foo{...}" - } + 3, + } // GC_ERROR "too few values in" _ = Foo{ 1, 2, 3, - Bar{"A", "B"}, // ERROR "too many values in Bar{...}|too many expressions" + Bar{"A", "B"}, // ERROR "too many values in|too many expressions" } _ = Foo{ // GCCGO_ERROR "too few expressions" 1, 2, - Bar{"A", "B"}, // ERROR "too many values in Bar{...}|too many expressions" "too few values in Foo{...}" - } + Bar{"A", "B"}, // ERROR "too many values in|too many expressions" + } // GC_ERROR "too few values in" } diff --git a/test/fixedbugs/issue25958.go b/test/fixedbugs/issue25958.go index 90fcee15fd..91358f83fe 100644 --- a/test/fixedbugs/issue25958.go +++ b/test/fixedbugs/issue25958.go @@ -11,7 +11,7 @@ package p func f(done chan struct{}) { select { - case done: // ERROR "must be receive|expected .*<-.* or .*=" "not used" - case (chan struct{})(done): // ERROR "must be receive|expected .*<-.* or .*=" + case done: // ERROR "must be receive|expected .*<-.* or .*=|must be send or receive|not used" + case (chan struct{})(done): // ERROR "must be receive|expected .*<-.* or .*=|must be send or receive" } } diff --git a/test/fixedbugs/issue28079b.go b/test/fixedbugs/issue28079b.go index 54c9db994b..69d1a2f480 100644 --- a/test/fixedbugs/issue28079b.go +++ b/test/fixedbugs/issue28079b.go @@ -10,8 +10,8 @@ package p import "unsafe" -type T [uintptr(unsafe.Pointer(nil))]int // ERROR "non-constant array bound|array bound is not constant" +type T [uintptr(unsafe.Pointer(nil))]int // ERROR "non-constant array bound|array bound is not constant|must be constant" func f() { - _ = complex(1<