1
0
mirror of https://github.com/golang/go synced 2024-11-26 02:07:57 -07:00

test: match gofrontend error messages

fixedbugs/issue14136.go:17:16: error: unknown field ‘X’ in ‘T’
fixedbugs/issue14136.go:18:13: error: incompatible type in initialization (cannot use type int as type string)

fixedbugs/issue14520.go:9:37: error: import path contains control character
fixedbugs/issue14520.go:14:2: error: expected ‘)’
fixedbugs/issue14520.go:14:3: error: expected declaration

fixedbugs/issue14652.go:9:7: error: use of undefined type ‘any’

fixedbugs/issue14729.go:13:17: error: embedded type may not be a pointer

fixedbugs/issue15514.dir/c.go:10: error: incompatible type in initialization

fixedbugs/issue15898.go:11:9: error: duplicate type in switch
fixedbugs/issue15898.go:16:9: error: duplicate type in switch

fixedbugs/issue16439.go:10:21: error: index expression is negative
fixedbugs/issue16439.go:13:21: error: index expression is negative
fixedbugs/issue16439.go:16:21: error: index expression is not integer constant
fixedbugs/issue16439.go:18:22: error: index expression is not integer constant

fixedbugs/issue17328.go:11:20: error: expected ‘{’
fixedbugs/issue17328.go:11:20: error: expected ‘;’ or ‘}’ or newline
fixedbugs/issue17328.go:13:1: error: expected declaration

fixedbugs/issue17588.go:14:15: error: expected type

fixedbugs/issue17631.go:20:17: error: unknown field ‘updates’ in ‘unnamed struct’

fixedbugs/issue17645.go:15:13: error: incompatible type in initialization

fixedbugs/issue17758.go:13:1: error: redefinition of ‘foo’
fixedbugs/issue17758.go:9:1: note: previous definition of ‘foo’ was here

fixedbugs/issue18092.go:13:19: error: expected colon

fixedbugs/issue18231.go:17:12: error: may only omit types within composite literals of slice, array, or map type

fixedbugs/issue18393.go:24:38: error: expected type

fixedbugs/issue18419.dir/test.go:12: error: reference to unexported field or method 'member'

fixedbugs/issue18655.go:14:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here
fixedbugs/issue18655.go:15:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here
fixedbugs/issue18655.go:16:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here
fixedbugs/issue18655.go:17:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here
fixedbugs/issue18655.go:18:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here
fixedbugs/issue18655.go:20:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here
fixedbugs/issue18655.go:21:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here
fixedbugs/issue18655.go:22:1: error: redefinition of ‘m’
fixedbugs/issue18655.go:13:1: note: previous definition of ‘m’ was here

fixedbugs/issue18915.go:13:20: error: expected ‘;’ after statement in if expression
fixedbugs/issue18915.go:16:21: error: parse error in for statement
fixedbugs/issue18915.go:19:24: error: expected ‘;’ after statement in switch expression
fixedbugs/issue18915.go:13:12: error: ‘a’ declared but not used
fixedbugs/issue18915.go:16:13: error: ‘b’ declared but not used
fixedbugs/issue18915.go:19:16: error: ‘c’ declared but not used

fixedbugs/issue19012.go:16:17: error: return with value in function with no return type
fixedbugs/issue19012.go:18:9: error: return with value in function with no return type
fixedbugs/issue19012.go:22:16: error: argument 2 has incompatible type (cannot use type bool as type uint)
fixedbugs/issue19012.go:22:9: error: too many arguments
fixedbugs/issue19012.go:22:16: error: incompatible types in binary expression
fixedbugs/issue19012.go:24:9: error: too many arguments

fixedbugs/issue19056.go:9:9: error: expected operand
fixedbugs/issue19056.go:9:9: error: expected ‘;’ or newline after top level declaration

fixedbugs/issue19482.go:25:15: error: expected struct field name
fixedbugs/issue19482.go:27:15: error: expected struct field name
fixedbugs/issue19482.go:31:19: error: expected struct field name
fixedbugs/issue19482.go:33:15: error: expected struct field name

fixedbugs/issue19667.go:13:1: error: expected operand
fixedbugs/issue19667.go:13:1: error: missing ‘)’
fixedbugs/issue19667.go:13:105: error: expected ‘;’ after statement in if expression
fixedbugs/issue19667.go:13:105: error: expected ‘{’
fixedbugs/issue19667.go:12:19: error: reference to undefined name ‘http’

Change-Id: Ia9c75b9c78671f354f0a0623dbc075157ef8f181
Reviewed-on: https://go-review.googlesource.com/c/go/+/277433
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Ian Lance Taylor 2020-12-11 19:53:32 -08:00
parent a58be734ea
commit ce61ccca8f
22 changed files with 46 additions and 46 deletions

View File

@ -14,6 +14,6 @@ package main
type T struct{}
func main() {
t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1} // ERROR "unknown field 'X' in struct literal of type T"
var s string = 1 // ERROR "cannot use 1"
t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1} // ERROR "unknown field 'X' in struct literal of type T|unknown field .*X.* in .*T.*"
var s string = 1 // ERROR "cannot use 1|incompatible type"
}

View File

@ -9,6 +9,6 @@ package f
import /* // ERROR "import path" */ `
bogus`
func f(x int /* // ERROR "unexpected newline"
func f(x int /* // GC_ERROR "unexpected newline"
*/)
*/) // GCCGO_ERROR "expected .*\).*|expected declaration"

View File

@ -6,4 +6,4 @@
package p
var x any // ERROR "undefined: any"
var x any // ERROR "undefined: any|undefined type .*any.*"

View File

@ -10,5 +10,5 @@ package main
import "unsafe"
type s struct { unsafe.Pointer } // ERROR "embedded type cannot be a pointer"
type s struct { unsafe.Pointer } // ERROR "embedded type cannot be a pointer|embedded type may not be a pointer"
type s1 struct { p unsafe.Pointer }

View File

@ -7,4 +7,4 @@ package c
import "./a"
import "./b"
var _ a.A = b.B() // ERROR "cannot use b\.B"
var _ a.A = b.B() // ERROR "cannot use b\.B|incompatible type"

View File

@ -8,11 +8,11 @@ package p
func f(e interface{}) {
switch e.(type) {
case nil, nil: // ERROR "multiple nil cases in type switch"
case nil, nil: // ERROR "multiple nil cases in type switch|duplicate type in switch"
}
switch e.(type) {
case nil:
case nil: // ERROR "multiple nil cases in type switch"
case nil: // ERROR "multiple nil cases in type switch|duplicate type in switch"
}
}

View File

@ -7,12 +7,12 @@
package p
var a []int = []int{1: 1}
var b []int = []int{-1: 1} // ERROR "must be non-negative integer constant"
var b []int = []int{-1: 1} // ERROR "must be non-negative integer constant|index expression is negative"
var c []int = []int{2.0: 2}
var d []int = []int{-2.0: 2} // ERROR "must be non-negative integer constant"
var d []int = []int{-2.0: 2} // ERROR "must be non-negative integer constant|index expression is negative"
var e []int = []int{3 + 0i: 3}
var f []int = []int{3i: 3} // ERROR "truncated to integer"
var f []int = []int{3i: 3} // ERROR "truncated to integer|index expression is not integer constant"
var g []int = []int{"a": 4} // ERROR "must be non-negative integer constant"
var g []int = []int{"a": 4} // ERROR "must be non-negative integer constant|index expression is not integer constant"

View File

@ -8,6 +8,6 @@ package main
func main() {
i := 0
for ; ; i++) { // ERROR "unexpected \), expecting { after for clause"
for ; ; i++) { // ERROR "unexpected \), expecting { after for clause|expected .*{.*|expected .*;.*"
}
}
} // GCCGO_ERROR "expected declaration"

View File

@ -11,7 +11,7 @@
package p
type F func(b T) // ERROR "T is not a type"
type F func(b T) // ERROR "T is not a type|expected type"
func T(fn F) {
func() {

View File

@ -17,6 +17,6 @@ func main() {
expect map[string]int
}{
about: "this one",
updates: map[string]int{"gopher": 10}, // ERROR "unknown field 'updates' in struct literal of type"
updates: map[string]int{"gopher": 10}, // ERROR "unknown field 'updates' in struct literal of type|unknown field .*updates.* in .*unnamed struct.*"
}
}

View File

@ -12,5 +12,5 @@ type Foo struct {
func main() {
var s []int
var _ string = append(s, Foo{""}) // ERROR "cannot use .. \(type untyped string\) as type int in field value" "cannot use Foo{...} \(type Foo\) as type int in append" "cannot use append\(s\, Foo{...}\) \(type \[\]int\) as type string in assignment"
var _ string = append(s, Foo{""}) // ERROR "cannot use .. \(type untyped string\) as type int in field value|incompatible type" "cannot use Foo{...} \(type Foo\) as type int in append" "cannot use append\(s\, Foo{...}\) \(type \[\]int\) as type string in assignment"
}

View File

@ -10,7 +10,7 @@ func foo() {
_ = func() {}
}
func foo() { // ERROR "foo redeclared in this block"
func foo() { // ERROR "foo redeclared in this block|redefinition of .*foo.*"
_ = func() {}
}

View File

@ -10,6 +10,6 @@ func _() {
var ch chan bool
select {
default:
case <-ch { // don't crash here
} // ERROR "expecting :"
case <-ch { // GCCGO_ERROR "expected colon"
} // GC_ERROR "expecting :"
}

View File

@ -14,7 +14,7 @@ type T struct {
}
var _ = T{
f: { // ERROR "missing type in composite literal"
f: { // ERROR "missing type in composite literal|may only omit types within"
"a": "b",
},
}

View File

@ -21,4 +21,4 @@ var x // error on line 24, not 30
// ERROR "syntax error: unexpected newline, expecting type"
// ERROR "syntax error: unexpected newline, expecting type|expected type"

View File

@ -9,7 +9,7 @@ package main
import "./other"
func InMyCode(e *other.Exported) {
e.member() // ERROR "e\.member undefined .cannot refer to unexported field or method other\.\(\*Exported\)\.member."
e.member() // ERROR "e\.member undefined .cannot refer to unexported field or method other\.\(\*Exported\)\.member.|unexported field or method"
}
func main() {}

View File

@ -11,12 +11,12 @@ type A = T
type B = T
func (T) m() {}
func (T) m() {} // ERROR "redeclared"
func (A) m() {} // ERROR "redeclared"
func (A) m() {} // ERROR "redeclared"
func (B) m() {} // ERROR "redeclared"
func (B) m() {} // ERROR "redeclared"
func (T) m() {} // ERROR "redeclared|redefinition"
func (A) m() {} // ERROR "redeclared|redefinition"
func (A) m() {} // ERROR "redeclared|redefinition"
func (B) m() {} // ERROR "redeclared|redefinition"
func (B) m() {} // ERROR "redeclared|redefinition"
func (*T) m() {} // ERROR "redeclared"
func (*A) m() {} // ERROR "redeclared"
func (*B) m() {} // ERROR "redeclared"
func (*T) m() {} // ERROR "redeclared|redefinition"
func (*A) m() {} // ERROR "redeclared|redefinition"
func (*B) m() {} // ERROR "redeclared|redefinition"

View File

@ -10,12 +10,12 @@
package p
func _() {
if a := 10 { // ERROR "cannot use a := 10 as value"
if a := 10 { // ERROR "cannot use a := 10 as value|expected .*;|declared but not used"
}
for b := 10 { // ERROR "cannot use b := 10 as value"
for b := 10 { // ERROR "cannot use b := 10 as value|parse error|declared but not used"
}
switch c := 10 { // ERROR "cannot use c := 10 as value"
switch c := 10 { // ERROR "cannot use c := 10 as value|expected .*;|declared but not used"
}
}

View File

@ -13,13 +13,13 @@ package main
func f(x int, y uint) {
if true {
return "a" > 10 // ERROR "^too many arguments to return$" "."
return "a" > 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 "gopher" == true, 10 // ERROR "^too many arguments to return$|return with value in function with no return|mismatched types"
}
func main() {
f(2, 3 < "x", 10) // ERROR "^too many arguments in call to f$" "."
f(2, 3 < "x", 10) // ERROR "too many arguments|invalid operation|incompatible type"
f(10, 10, "a") // ERROR "too many arguments in call to f\n\thave \(number, number, string\)\n\twant \(int, uint\)"
f(10, 10, "a") // ERROR "too many arguments"
}

View File

@ -6,4 +6,4 @@
package p
var _ = ... . // ERROR "unexpected ..."
var _ = ... . // ERROR "unexpected ...|expected operand|expected .*;"

View File

@ -22,13 +22,13 @@ func ok() {
var (
y = T{"stare"}
w = T{_: "look"} // ERROR "invalid field name _ in struct initializer"
w = T{_: "look"} // ERROR "invalid field name _ in struct initializer|expected struct field name"
_ = T{"page"}
_ = T{_: "out"} // ERROR "invalid field name _ in struct initializer"
_ = T{_: "out"} // ERROR "invalid field name _ in struct initializer|expected struct field name"
)
func bad() {
var z = T{_: "verse"} // ERROR "invalid field name _ in struct initializer"
var z = T{_: "verse"} // ERROR "invalid field name _ in struct initializer|expected struct field name"
_ = z
_ = T{_: "itinerary"} // ERROR "invalid field name _ in struct initializer"
_ = T{_: "itinerary"} // ERROR "invalid field name _ in struct initializer|expected struct field name"
}

View File

@ -9,5 +9,5 @@
package p
func f() {
if err := http.ListenAndServe(
} // ERROR "unexpected }, expecting expression"
if err := http.ListenAndServe( // GCCGO_ERROR "undefined name"
} // ERROR "unexpected }, expecting expression|expected operand|missing .*\)|expected .*;|expected .*{"