_ = copy() // ERROR "not enough arguments"
_ = copy(1, 2, 3) // ERROR "too many arguments"
- _ = copy(si, "hi") // ERROR "have different element types.*int.*string"
+ _ = copy(si, "hi") // ERROR "have different element types(.*int.*string| int and byte)"
_ = copy(si, sf) // ERROR "have different element types.*int.*float64"
- _ = copy(1, 2) // ERROR "must be slices; have int, int"
- _ = copy(1, si) // ERROR "first argument to copy should be"
- _ = copy(si, 2) // ERROR "second argument to copy should be"
+ _ = copy(1, 2) // ERROR "must be slices; have int, int|expects slice arguments"
+ _ = copy(1, si) // ERROR "first argument to copy should be|expects slice arguments"
+ _ = copy(si, 2) // ERROR "second argument to copy should be|expects slice arguments"
}
package main
type I interface {
- int // ERROR "interface contains embedded non-interface int"
+ int // ERROR "interface contains embedded non-interface int|not an interface"
}
func New() I {
package a
-import "fmt" // ERROR "imported and not used"
+import "fmt" // ERROR "imported and not used|imported but not used"
-const n = fmt // ERROR "fmt without selector"
+const n = fmt // ERROR "fmt without selector|not in selector"
package issue11371
-const a int = 1.1 // ERROR "constant 1.1 truncated to integer"
-const b int = 1e20 // ERROR "overflows int"
-const c int = 1 + 1e-100 // ERROR "constant truncated to integer"
-const d int = 1 - 1e-100 // ERROR "constant truncated to integer"
-const e int = 1.00000001 // ERROR "constant truncated to integer"
-const f int = 0.00000001 // ERROR "constant 1e-08 truncated to integer"
+const a int = 1.1 // ERROR "constant 1.1 truncated to integer|truncated to int"
+const b int = 1e20 // ERROR "overflows int|truncated to int"
+const c int = 1 + 1e-100 // ERROR "constant truncated to integer|truncated to int"
+const d int = 1 - 1e-100 // ERROR "constant truncated to integer|truncated to int"
+const e int = 1.00000001 // ERROR "constant truncated to integer|truncated to int"
+const f int = 0.00000001 // ERROR "constant 1e-08 truncated to integer|truncated to int"
func g() func(int)
func main() {
- Fooer.Foo(5, 6) // ERROR "not enough arguments in call to method expression Fooer.Foo"
+ Fooer.Foo(5, 6) // ERROR "not enough arguments in call to method expression Fooer.Foo|not enough arguments in call"
var i I
var t *T
g()() // ERROR "not enough arguments in call to g\(\)"
f() // ERROR "not enough arguments in call to f"
i.M() // ERROR "not enough arguments in call to i\.M"
- I.M() // ERROR "not enough arguments in call to method expression I\.M"
+ I.M() // ERROR "not enough arguments in call to method expression I\.M|not enough arguments in call"
t.M() // ERROR "not enough arguments in call to t\.M"
- T.M() // ERROR "not enough arguments in call to method expression T\.M"
- (*T).M() // ERROR "not enough arguments in call to method expression \(\*T\)\.M"
+ T.M() // ERROR "not enough arguments in call to method expression T\.M|not enough arguments in call"
+ (*T).M() // ERROR "not enough arguments in call to method expression \(\*T\)\.M|not enough arguments in call"
}
package main
func main() {
- _ = []byte{"foo"} // ERROR "cannot use"
- _ = []int{"foo"} // ERROR "cannot use"
- _ = []rune{"foo"} // ERROR "cannot use"
+ _ = []byte{"foo"} // ERROR "cannot use|cannot convert"
+ _ = []int{"foo"} // ERROR "cannot use|cannot convert"
+ _ = []rune{"foo"} // ERROR "cannot use|cannot convert"
_ = []string{"foo"} // OK
}
package main
func main() {
- n.foo = 6 // ERROR "undefined: n in n.foo"
+ n.foo = 6 // ERROR "undefined: n in n.foo|undefined: n"
}
package p
func f(s string) {
- var _ float64 = s[2] // ERROR "cannot use.*type byte.*as type float64"
+ var _ float64 = s[2] // ERROR "cannot use.*type byte.*as type float64|cannot use .* as float64 value"
}
func main() {
var x int
+ _ = x
x = make(map[int]int) // ERROR "cannot use make\(map\[int\]int\)|incompatible"
x = make(map[int]int, 0) // ERROR "cannot use make\(map\[int\]int, 0\)|incompatible"
x = make(map[int]int, zero) // ERROR "cannot use make\(map\[int\]int, zero\)|incompatible"
_ = 1 != e
_ = 1 >= e // ERROR "invalid operation.*not defined"
- _ = i == 1 // ERROR "invalid operation.*mismatched types"
- _ = i != 1 // ERROR "invalid operation.*mismatched types"
- _ = i >= 1 // ERROR "invalid operation.*mismatched types"
- _ = 1 == i // ERROR "invalid operation.*mismatched types"
- _ = 1 != i // ERROR "invalid operation.*mismatched types"
- _ = 1 >= i // ERROR "invalid operation.*mismatched types"
+ _ = i == 1 // ERROR "invalid operation.*mismatched types|cannot convert"
+ _ = i != 1 // ERROR "invalid operation.*mismatched types|cannot convert"
+ _ = i >= 1 // ERROR "invalid operation.*mismatched types|cannot convert"
+ _ = 1 == i // ERROR "invalid operation.*mismatched types|cannot convert"
+ _ = 1 != i // ERROR "invalid operation.*mismatched types|cannot convert"
+ _ = 1 >= i // ERROR "invalid operation.*mismatched types|cannot convert"
_ = e == f // ERROR "invalid operation.*not defined"
_ = e != f // ERROR "invalid operation.*not defined"
// See golang.org/issue/9432.
package p
-type foo struct { // ERROR "invalid recursive type"
+type foo struct { // ERROR "invalid recursive type|cycle"
bar foo
blah foo
}
func g() (x []int, y float64) { return }
func main() {
- _ = append(f()) // ERROR "cannot use \[\]int value as type int in append"
- _ = append(g()) // ERROR "cannot use float64 value as type int in append"
+ _ = append(f()) // ERROR "cannot use \[\]int value as type int in append|cannot use .* as int value"
+ _ = append(g()) // ERROR "cannot use float64 value as type int in append|cannot use .* as int value"
}
t []int
u int
}{}
- _ = append(s, 0) // ERROR "must be a slice|must be slice"
+ _ = append(s, 0) // ERROR "must be a slice|must be slice|not a slice"
}
}
-func f2(a int) (a int, b float32) { // ERROR "duplicate argument a|definition"
+func f2(a int) (a int, b float32) { // ERROR "duplicate argument a|definition|redeclared"
return 8, 8.0
}
package p
type T interface {
- F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous"
- F2(i, i int) // ERROR "duplicate argument i|redefinition|previous"
- F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous"
+ F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+ F2(i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+ F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
}
-type T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous"
-type T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous"
-type T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous"
+type T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+type T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+type T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
type R struct{}
-func (i *R) F1(i int) {} // ERROR "duplicate argument i|redefinition|previous"
-func (i *R) F2() (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous"
-func (i *R) F3(j int) (j int) {return 0} // ERROR "duplicate argument j|redefinition|previous"
+func (i *R) F1(i int) {} // ERROR "duplicate argument i|redefinition|previous|redeclared"
+func (i *R) F2() (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous|redeclared"
+func (i *R) F3(j int) (j int) {return 0} // ERROR "duplicate argument j|redefinition|previous|redeclared"
-func F1(i, i int) {} // ERROR "duplicate argument i|redefinition|previous"
-func F2(i int) (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous"
-func F3() (i, i int) {return 0, 0} // ERROR "duplicate argument i|redefinition|previous"
+func F1(i, i int) {} // ERROR "duplicate argument i|redefinition|previous|redeclared"
+func F2(i int) (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous|redeclared"
+func F3() (i, i int) {return 0, 0} // ERROR "duplicate argument i|redefinition|previous|redeclared"
package p
var T interface {
- F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous"
- F2(i, i int) // ERROR "duplicate argument i|redefinition|previous"
- F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous"
+ F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+ F2(i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+ F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
}
-var T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous"
-var T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous"
-var T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous"
+var T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+var T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
+var T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous|redeclared"
func main() {
init() // ERROR "undefined.*init"
- runtime.init() // ERROR "undefined.*runtime\.init"
+ runtime.init() // ERROR "undefined.*runtime\.init|undefined: runtime"
var _ = init // ERROR "undefined.*init"
}
var (
x int = a
- a int = b // ERROR "a refers to\n.*b refers to\n.*c refers to\n.*a"
+ a int = b // ERROR "a refers to\n.*b refers to\n.*c refers to\n.*a|initialization cycle"
b int = c
c int = a
)
package main
func main() {
- _ = make() // ERROR "missing argument"
- _ = make(int) // ERROR "cannot make type"
- _ = make([]int) // ERROR "missing len argument"
+ _ = make() // ERROR "missing argument|not enough arguments"
+ _ = make(int) // ERROR "cannot make type|cannot make int"
+ _ = make([]int) // ERROR "missing len argument|expects 2 or 3 arguments"
- _ = new() // ERROR "missing argument"
+ _ = new() // ERROR "missing argument|not enough arguments"
_ = new(int, 2) // ERROR "too many arguments"
}
func main() {
m := make(map[int]int)
- delete() // ERROR "missing arguments"
- delete(m) // ERROR "missing second \(key\) argument"
+ delete() // ERROR "missing arguments|not enough arguments"
+ delete(m) // ERROR "missing second \(key\) argument|not enough arguments"
delete(m, 2, 3) // ERROR "too many arguments"
- delete(1, m) // ERROR "first argument to delete must be map"
+ delete(1, m) // ERROR "first argument to delete must be map|is not a map"
}
\ No newline at end of file
type P *T
type P1 *T
-func (p P) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
-func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
+func (p P) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver|invalid receiver"
+func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver|invalid receiver"
type I interface{}
type I1 interface{}
func (t *T) g() int { return t.a }
-var _ = (T).g() // ERROR "needs pointer receiver|undefined"
+var _ = (T).g() // ERROR "needs pointer receiver|undefined|cannot call pointer method"
var _ = func() {
var a A
- A(a).g() // ERROR "cannot call pointer method on|cannot take the address of"
+ A(a).g() // ERROR "cannot call pointer method .*on|cannot take the address of"
}
_ = b
_, bb := <-c
- asBool(bb) // ERROR "cannot use.*type bool.*as type Bool"
+ asBool(bb) // ERROR "cannot use.*type bool.*as type Bool|cannot use bb"
_, b = <-c // ok now
_ = b
var n byte // ERROR "not a type|expected type"
var y = float32(0) // ERROR "cannot call|expected function"
const (
- a = 1 + iota // ERROR "invalid operation|incompatible types"
+ a = 1 + iota // ERROR "invalid operation|incompatible types|cannot convert"
)
}
t.updateErrors(string(out), long)
}
t.err = t.errorCheck(string(out), wantAuto, long, t.gofile)
+ if t.err != nil {
+ return // don't hide error if run below succeeds
+ }
// The following is temporary scaffolding to get types2 typechecker
// up and running against the existing test cases. The explicitly
for _, flag := range flags {
for _, pattern := range []string{
"-+",
+ "-0",
"-m",
"-live",
"wb",
"typeassert",
"ssa/check_bce/debug",
"ssa/intrinsics/debug",
+ "ssa/opt/debug",
"ssa/prove/debug",
"ssa/likelyadjust/debug",
"ssa/insert_resched_checks/off",
// List of files that the compiler cannot errorcheck with the new typechecker (compiler -G option).
// Temporary scaffolding until we pass all the tests at which point this map can be removed.
var excluded = map[string]bool{
- "complit1.go": true,
- "const2.go": true,
- "convlit.go": true,
- "copy1.go": true,
- "ddd1.go": true,
- "devirt.go": true,
- "directive.go": true,
- "float_lit3.go": true,
- "func1.go": true,
- "funcdup.go": true,
- "funcdup2.go": true,
- "import1.go": true,
- "import5.go": true,
- "import6.go": true,
- "init.go": true,
- "initializerr.go": true,
- "initloop.go": true,
- "makechan.go": true,
- "makemap.go": true,
- "makenew.go": true,
- "map1.go": true,
- "method2.go": true,
- "method6.go": true,
- "named1.go": true,
- "rename1.go": true,
- "runtime.go": true,
- "shift1.go": true,
- "slice3err.go": true,
- "switch3.go": true,
- "switch4.go": true,
- "switch5.go": true,
- "switch6.go": true,
- "switch7.go": true,
- "typecheck.go": true,
- "typecheckloop.go": true,
- "typeswitch3.go": true,
- "undef.go": true,
- "varerr.go": true,
+ "complit1.go": true,
+ "const2.go": true,
+ "convlit.go": true,
+ "ddd1.go": true, // issue #42987
+ "directive.go": true, // misplaced compiler directive checks
+ "float_lit3.go": true,
+ "import1.go": true,
+ "import5.go": true, // issue #42988
+ "import6.go": true,
+ "initializerr.go": true,
+ "makechan.go": true,
+ "makemap.go": true,
+ "shift1.go": true, // issue #42989
+ "slice3err.go": true,
+ "switch3.go": true,
+ "switch4.go": true,
+ "switch5.go": true,
+ "switch6.go": true,
+ "switch7.go": true,
+ "typecheck.go": true, // invalid function is not causing errors when called
"fixedbugs/bug163.go": true,
"fixedbugs/bug176.go": true,
"fixedbugs/bug462.go": true,
"fixedbugs/bug463.go": true,
"fixedbugs/bug487.go": true,
- "fixedbugs/issue10975.go": true,
"fixedbugs/issue11326.go": true,
- "fixedbugs/issue11361.go": true,
"fixedbugs/issue11362.go": true,
- "fixedbugs/issue11371.go": true,
"fixedbugs/issue11590.go": true,
"fixedbugs/issue11610.go": true,
"fixedbugs/issue11614.go": true,
"fixedbugs/issue7746.go": true, // type-checking doesn't terminate
"fixedbugs/issue8501.go": true, // crashes
"fixedbugs/issue8507.go": true, // crashes
- "fixedbugs/issue8183.go": true,
- "fixedbugs/issue8385.go": true,
- "fixedbugs/issue8438.go": true,
- "fixedbugs/issue8440.go": true,
- "fixedbugs/issue8745.go": true,
- "fixedbugs/issue9083.go": true,
- "fixedbugs/issue9370.go": true,
- "fixedbugs/issue9432.go": true,
- "fixedbugs/issue9521.go": true,
- "fixedbugs/issue9634.go": true,
+ "fixedbugs/issue8183.go": true, // issue #42992
}
import "runtime"
func main() {
- runtime.printbool(true) // ERROR "unexported"
+ runtime.printbool(true) // ERROR "unexported|not declared"
}
package main
-const A = 1 + B // ERROR "constant definition loop\n.*A uses B\n.*B uses C\n.*C uses A"
-const B = C - 1 // ERROR "constant definition loop\n.*B uses C\n.*C uses B"
+const A = 1 + B // ERROR "constant definition loop\n.*A uses B\n.*B uses C\n.*C uses A|initialization cycle"
+const B = C - 1 // ERROR "constant definition loop\n.*B uses C\n.*C uses B|initialization cycle"
const C = A + B + 1
}
// Issue 2827.
- switch _ := r.(type) { // ERROR "invalid variable name _|no new variables"
+ switch _ := r.(type) { // ERROR "invalid variable name _|no new variables?"
}
}
func noninterface() {
var i int
- switch i.(type) { // ERROR "cannot type switch on non-interface value"
+ switch i.(type) { // ERROR "cannot type switch on non-interface value|not an interface type"
case string:
case int:
}
name string
}
var s S
- switch s.(type) { // ERROR "cannot type switch on non-interface value"
+ switch s.(type) { // ERROR "cannot type switch on non-interface value|not an interface type"
}
}
func main() {
_ = asdf // ERROR "undefined.*asdf"
- new = 1 // ERROR "use of builtin new not in function call|invalid left hand side"
+ new = 1 // ERROR "use of builtin new not in function call|invalid left hand side|must be called"
}