1
0
mirror of https://github.com/golang/go synced 2024-11-26 03:27:58 -07:00

test: recognize gofrontend error messages

fixedbugs/issue26416.go:24:16: error: unknown field ‘t1f1’ in ‘t2’
fixedbugs/issue26416.go:25:16: error: unknown field ‘t1f2’ in ‘t3’
fixedbugs/issue26416.go:26:16: error: unknown field ‘t2f1’ in ‘t3’

fixedbugs/issue26616.go:15:9: error: single variable set to multiple-value function call
fixedbugs/issue26616.go:9:5: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:12:13: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:13:13: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:15:9: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:14:11: error: incompatible types in assignment (multiple-value function call in single-value context)

fixedbugs/issue26855.go:23:12: error: incompatible type for field 1 in struct construction
fixedbugs/issue26855.go:27:12: error: incompatible type for field 1 in struct construction

fixedbugs/issue25958.go:14:18: error: expected ‘<-’ or ‘=’
fixedbugs/issue25958.go:15:35: error: expected ‘<-’ or ‘=’

fixedbugs/issue28079b.go:13:9: error: array bound is not constant
fixedbugs/issue28079b.go:16:22: error: invalid context-determined non-integer type for left operand of shift

fixedbugs/issue28079c.go:14:22: error: invalid context-determined non-integer type for left operand of shift

fixedbugs/issue28450.go:9:19: error: ‘...’ only permits one name
fixedbugs/issue28450.go:10:18: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:11:16: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:11:24: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:13:25: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:15:19: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:16:21: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:16:31: error: ‘...’ must be last parameter

fixedbugs/issue28268.go:20:1: error: method ‘E’ redeclares struct field name
fixedbugs/issue28268.go:19:1: error: method ‘b’ redeclares struct field name

fixedbugs/issue27356.go:14:14: error: expected function
fixedbugs/issue27356.go:18:9: error: expected function

fixedbugs/issue29855.go:13:11: error: unknown field ‘Name’ in ‘T’

fixedbugs/issue27938.go:14:15: error: expected package
fixedbugs/issue27938.go:18:13: error: expected package
fixedbugs/issue27938.go:22:13: error: expected package
fixedbugs/issue27938.go:22:9: error: expected signature or type name

fixedbugs/issue29870b.go:13:9: error: ‘x’ declared but not used

fixedbugs/issue30085.go:10:18: error: wrong number of initializations
fixedbugs/issue30085.go:11:21: error: wrong number of initializations

fixedbugs/issue30087.go:10:18: error: wrong number of initializations
fixedbugs/issue30087.go:11:11: error: number of variables does not match number of values
fixedbugs/issue30087.go:12:9: error: wrong number of initializations
fixedbugs/issue30087.go:13:9: error: wrong number of initializations

fixedbugs/issue28926.go:16:14: error: use of undefined type ‘G’
fixedbugs/issue28926.go:18:14: error: use of undefined type ‘E’
fixedbugs/issue28926.go:22:24: error: use of undefined type ‘T’

fixedbugs/issue30722.go:13:13: error: invalid numeric literal
fixedbugs/issue30722.go:14:13: error: invalid numeric literal
fixedbugs/issue30722.go:15:13: error: invalid numeric literal

fixedbugs/issue33308.go:12:19: error: invalid context-determined non-integer type for left operand of shift

fixedbugs/issue33386.go:16:9: error: expected operand
fixedbugs/issue33386.go:22:9: error: expected operand
fixedbugs/issue33386.go:26:17: error: expected operand
fixedbugs/issue33386.go:27:18: error: expected operand
fixedbugs/issue33386.go:28:29: error: expected operand
fixedbugs/issue33386.go:15:17: error: reference to undefined name ‘send’
fixedbugs/issue33386.go:27:13: error: reference to undefined name ‘a’
fixedbugs/issue33386.go:21:19: error: value computed is not used

fixedbugs/issue33460.go:34:10: error: duplicate key in map literal
fixedbugs/issue33460.go:21:9: error: duplicate case in switch
fixedbugs/issue33460.go:24:9: error: duplicate case in switch
fixedbugs/issue33460.go:25:9: error: duplicate case in switch

fixedbugs/issue32723.go:12:14: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:13:13: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:16:16: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:17:16: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:18:15: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:21:15: error: invalid comparison of non-ordered type

fixedbugs/issue35291.go:13:9: error: duplicate value for index 1

fixedbugs/issue38745.go:12:12: error: reference to undefined field or method ‘M’
fixedbugs/issue38745.go:13:16: error: reference to undefined field or method ‘M’
fixedbugs/issue38745.go:17:19: error: reference to undefined field or method ‘M’
fixedbugs/issue38745.go:17:9: error: not enough arguments to return

fixedbugs/issue41500.go:16:22: error: incompatible types in binary expression
fixedbugs/issue41500.go:17:26: error: incompatible types in binary expression
fixedbugs/issue41500.go:18:22: error: incompatible types in binary expression
fixedbugs/issue41500.go:19:26: error: incompatible types in binary expression

fixedbugs/issue41575.go:23:6: error: invalid recursive type
fixedbugs/issue41575.go:9:6: error: invalid recursive type ‘T1’
fixedbugs/issue41575.go:13:6: error: invalid recursive type ‘T2’
fixedbugs/issue41575.go:17:6: error: invalid recursive type ‘a’
fixedbugs/issue41575.go:18:6: error: invalid recursive type ‘b’
fixedbugs/issue41575.go:19:6: error: invalid recursive type ‘c’
fixedbugs/issue41575.go:25:6: error: invalid recursive type ‘g’
fixedbugs/issue41575.go:32:6: error: invalid recursive type ‘x’
fixedbugs/issue41575.go:33:6: error: invalid recursive type ‘y’

fixedbugs/issue4215.go:10:9: error: not enough arguments to return
fixedbugs/issue4215.go:14:9: error: return with value in function with no return type
fixedbugs/issue4215.go:19:17: error: not enough arguments to return
fixedbugs/issue4215.go:21:9: error: not enough arguments to return
fixedbugs/issue4215.go:27:17: error: not enough arguments to return
fixedbugs/issue4215.go:29:17: error: too many values in return statement
fixedbugs/issue4215.go:31:17: error: not enough arguments to return
fixedbugs/issue4215.go:43:17: error: not enough arguments to return
fixedbugs/issue4215.go:46:17: error: not enough arguments to return
fixedbugs/issue4215.go:48:9: error: too many values in return statement
fixedbugs/issue4215.go:52:9: error: too many values in return statement

fixedbugs/issue41247.go:10:16: error: incompatible type for return value 1

fixedbugs/issue41440.go:13:9: error: too many arguments

fixedbugs/issue6772.go:10:16: error: ‘a’ repeated on left side of :=
fixedbugs/issue6772.go:17:16: error: ‘a’ repeated on left side of :=

fixedbugs/issue6402.go:12:16: error: incompatible type for return value 1

fixedbugs/issue6403.go:13:23: error: reference to undefined identifier ‘syscall.X’
fixedbugs/issue6403.go:14:15: error: reference to undefined name ‘voidpkg’

fixedbugs/issue7746.go:24:20: error: constant multiplication overflow

fixedbugs/issue7760.go:15:7: error: invalid constant type
fixedbugs/issue7760.go:16:7: error: invalid constant type
fixedbugs/issue7760.go:18:7: error: invalid constant type
fixedbugs/issue7760.go:19:7: error: invalid constant type
fixedbugs/issue7760.go:21:11: error: expression is not constant
fixedbugs/issue7760.go:22:11: error: expression is not constant
fixedbugs/issue7760.go:24:7: error: invalid constant type
fixedbugs/issue7760.go:25:7: error: invalid constant type

fixedbugs/issue7129.go:18:11: error: argument 1 has incompatible type (cannot use type bool as type int)
fixedbugs/issue7129.go:19:11: error: argument 1 has incompatible type (cannot use type bool as type int)
fixedbugs/issue7129.go:20:11: error: argument 1 has incompatible type (cannot use type bool as type int)
fixedbugs/issue7129.go:20:17: error: argument 2 has incompatible type (cannot use type bool as type int)

fixedbugs/issue7150.go:12:20: error: index expression is negative
fixedbugs/issue7150.go:13:13: error: some element keys in composite literal are out of range
fixedbugs/issue7150.go:14:13: error: some element keys in composite literal are out of range
fixedbugs/issue7150.go:15:13: error: some element keys in composite literal are out of range
fixedbugs/issue7150.go:16:13: error: some element keys in composite literal are out of range

fixedbugs/issue7675.go:16:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:16:24: error: argument 3 has incompatible type (cannot use type string as type float64)
fixedbugs/issue7675.go:16:9: error: not enough arguments
fixedbugs/issue7675.go:16:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:18:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:18:24: error: argument 3 has incompatible type (cannot use type string as type float64)
fixedbugs/issue7675.go:18:28: error: argument 4 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:18:9: error: too many arguments
fixedbugs/issue7675.go:18:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:19:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:19:9: error: not enough arguments
fixedbugs/issue7675.go:19:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:21:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:21:19: error: argument 3 has incompatible type
fixedbugs/issue7675.go:21:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:23:14: error: floating-point constant truncated to integer

fixedbugs/issue7153.go:11:15: error: reference to undefined name ‘a’
fixedbugs/issue7153.go:11:18: error: incompatible type for element 1 in composite literal
fixedbugs/issue7153.go:11:24: error: incompatible type for element 2 in composite literal

fixedbugs/issue7310.go:12:13: error: left argument must be a slice
fixedbugs/issue7310.go:13:13: error: second argument must be slice or string
fixedbugs/issue7310.go:14:15: error: incompatible types in binary expression

fixedbugs/issue6964.go:10:13: error: invalid type conversion (cannot use type complex128 as type string)

fixedbugs/issue7538a.go:14:9: error: reference to undefined label ‘_’

fixedbugs/issue8311.go:14:9: error: increment or decrement of non-numeric type

fixedbugs/issue8507.go:12:6: error: invalid recursive type ‘T’

fixedbugs/issue9521.go:16:20: error: argument 2 has incompatible type
fixedbugs/issue9521.go:17:20: error: argument 2 has incompatible type (cannot use type float64 as type int)

fixedbugs/issue8385.go:30:19: error: argument 1 has incompatible type (type has no methods)
fixedbugs/issue8385.go:30:14: error: not enough arguments
fixedbugs/issue8385.go:35:9: error: not enough arguments
fixedbugs/issue8385.go:36:9: error: not enough arguments
fixedbugs/issue8385.go:37:10: error: not enough arguments
fixedbugs/issue8385.go:38:10: error: not enough arguments
fixedbugs/issue8385.go:39:10: error: not enough arguments
fixedbugs/issue8385.go:40:10: error: not enough arguments
fixedbugs/issue8385.go:41:13: error: not enough arguments

fixedbugs/issue8438.go:13:23: error: incompatible type for element 1 in composite literal
fixedbugs/issue8438.go:14:22: error: incompatible type for element 1 in composite literal
fixedbugs/issue8438.go:15:23: error: incompatible type for element 1 in composite literal

fixedbugs/issue8440.go:10:9: error: reference to undefined name ‘n’

Change-Id: I5707aec7d3c9178c4f4d794d4827fc907b52efb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/278032
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Ian Lance Taylor 2020-12-14 13:26:35 -08:00
parent 663cd862ed
commit 5a25a3fd1d
48 changed files with 147 additions and 147 deletions

View File

@ -11,7 +11,7 @@ package p
func f(done chan struct{}) {
select {
case done: // ERROR "must be receive", "not used"
case (chan struct{})(done): // ERROR "must be receive"
case done: // ERROR "must be receive|expected .*<-.* or .*=" "not used"
case (chan struct{})(done): // ERROR "must be receive|expected .*<-.* or .*="
}
}

View File

@ -21,7 +21,7 @@ type t3 struct {
}
var (
_ = t2{t1f1: 600} // ERROR "cannot use promoted field t1.t1f1 in struct literal of type t2"
_ = t3{t1f2: 800} // ERROR "cannot use promoted field t2.t1.t1f2 in struct literal of type t3"
_ = t3{t2f1: 900} // ERROR "cannot use promoted field t2.t2f1 in struct literal of type t3"
_ = t2{t1f1: 600} // ERROR "cannot use promoted field t1.t1f1 in struct literal of type t2|unknown field"
_ = t3{t1f2: 800} // ERROR "cannot use promoted field t2.t1.t1f2 in struct literal of type t3|unknown field"
_ = t3{t2f1: 900} // ERROR "cannot use promoted field t2.t2f1 in struct literal of type t3|unknown field"
)

View File

@ -6,13 +6,13 @@
package p
var x int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values"
var x int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
func f() {
var _ int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values"
var a int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values"
a = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values"
b := three() // ERROR "assignment mismatch: 1 variable but three returns 3 values"
var _ int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
var a int = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
a = three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|multiple-value function call in single-value context"
b := three() // ERROR "assignment mismatch: 1 variable but three returns 3 values|single variable set to multiple-value|multiple-value function call in single-value context"
_, _ = a, b
}

View File

@ -20,9 +20,9 @@ type P struct {
type T struct{}
var _ = S{
f: &T{}, // ERROR "cannot use &T{}"
f: &T{}, // ERROR "cannot use &T{}|incompatible type"
}
var _ = P{
f: T{}, // ERROR "cannot use T{}"
f: T{}, // ERROR "cannot use T{}|incompatible type"
}

View File

@ -11,9 +11,9 @@ package p
var a = []int{1,2,3}
func _(len int) {
_ = len(a) // ERROR "cannot call non-function"
_ = len(a) // ERROR "cannot call non-function|expected function"
}
var cap = false
var _ = cap(a) // ERROR "cannot call non-function"
var _ = cap(a) // ERROR "cannot call non-function|expected function"

View File

@ -11,13 +11,13 @@
package p
type _ struct {
F sync.Mutex // ERROR "undefined: sync"
F sync.Mutex // ERROR "undefined: sync|expected package"
}
type _ struct {
sync.Mutex // ERROR "undefined: sync"
sync.Mutex // ERROR "undefined: sync|expected package"
}
type _ interface {
sync.Mutex // ERROR "undefined: sync"
sync.Mutex // ERROR "undefined: sync|expected package|expected signature or type name"
}

View File

@ -10,8 +10,8 @@ package p
import "unsafe"
type T [uintptr(unsafe.Pointer(nil))]int // ERROR "non-constant array bound"
type T [uintptr(unsafe.Pointer(nil))]int // ERROR "non-constant array bound|array bound is not constant"
func f() {
_ = complex(1<<uintptr(unsafe.Pointer(nil)), 0)
_ = complex(1<<uintptr(unsafe.Pointer(nil)), 0) // GCCGO_ERROR "non-integer type for left operand of shift"
}

View File

@ -11,5 +11,5 @@ package p
import "unsafe"
func f() {
_ = complex(1<<uintptr(unsafe.Pointer(nil)), 0) // ERROR "invalid operation: .*shift of type float64.*"
_ = complex(1<<uintptr(unsafe.Pointer(nil)), 0) // ERROR "invalid operation: .*shift of type float64.*|non-integer type for left operand of shift"
}

View File

@ -16,8 +16,8 @@ type T struct {
type E struct{}
func (T) b() {} // ERROR "field and method named b"
func (*T) E() {} // ERROR "field and method named E"
func (T) b() {} // ERROR "field and method named b|redeclares struct field name"
func (*T) E() {} // ERROR "field and method named E|redeclares struct field name"
func _() {
var x T

View File

@ -6,13 +6,13 @@
package p
func f(a, b, c, d ...int) {} // ERROR "non-final parameter a"
func g(a ...int, b ...int) {} // ERROR "non-final parameter a"
func h(...int, ...int, float32) {} // ERROR "non-final parameter"
func f(a, b, c, d ...int) {} // ERROR "non-final parameter a|only permits one name"
func g(a ...int, b ...int) {} // ERROR "non-final parameter a|must be last parameter"
func h(...int, ...int, float32) {} // ERROR "non-final parameter|must be last parameter"
type a func(...float32, ...interface{}) // ERROR "non-final parameter"
type a func(...float32, ...interface{}) // ERROR "non-final parameter|must be last parameter"
type b interface {
f(...int, ...int) // ERROR "non-final parameter"
g(a ...int, b ...int, c float32) // ERROR "non-final parameter a"
f(...int, ...int) // ERROR "non-final parameter|must be last parameter"
g(a ...int, b ...int, c float32) // ERROR "non-final parameter a|must be last parameter"
valid(...int)
}

View File

@ -13,12 +13,12 @@ type Stringer interface {
func main() {
var e interface{}
switch e := e.(type) {
case G: // ERROR "undefined: G"
case G: // ERROR "undefined: G|undefined type .*G"
e.M() // ok: this error should be ignored because the case failed its typecheck
case E: // ERROR "undefined: E"
case E: // ERROR "undefined: E|undefined type .*E"
e.D() // ok: this error should be ignored because the case failed its typecheck
case Stringer:
// ok: this error should not be ignored to prove that passing legs aren't left out
_ = e.(T) // ERROR "undefined: T"
_ = e.(T) // ERROR "undefined: T|undefined type .*T"
}
}

View File

@ -10,7 +10,7 @@ type T struct {
GlobalName string
}
var t = T{Name: "foo"} // ERROR "unknown field 'Name' in struct literal of type T"
var t = T{Name: "foo"} // ERROR "unknown field 'Name' in struct literal of type T|unknown field .*Name.* in .*T"
func (t T) Name() string {
return t.GlobalName

View File

@ -10,5 +10,5 @@
package main
func _() {
x := 7 // ERROR "x declared but not used"
x := 7 // ERROR ".*x.* declared but not used"
}

View File

@ -7,6 +7,6 @@
package main
func main() {
var c, d = 1, 2, 3 // ERROR "assignment mismatch: 2 variables but 3 values"
var e, f, g = 1, 2 // ERROR "assignment mismatch: 3 variables but 2 values"
var c, d = 1, 2, 3 // ERROR "assignment mismatch: 2 variables but 3 values|wrong number of initializations"
var e, f, g = 1, 2 // ERROR "assignment mismatch: 3 variables but 2 values|wrong number of initializations"
}

View File

@ -7,8 +7,8 @@
package main
func main() {
var a, b = 1 // ERROR "assignment mismatch: 2 variables but 1 values"
_ = 1, 2 // ERROR "assignment mismatch: 1 variables but 2 values"
c, d := 1 // ERROR "assignment mismatch: 2 variables but 1 values"
e, f := 1, 2, 3 // ERROR "assignment mismatch: 2 variables but 3 values"
var a, b = 1 // ERROR "assignment mismatch: 2 variables but 1 values|wrong number of initializations"
_ = 1, 2 // ERROR "assignment mismatch: 1 variables but 2 values|number of variables does not match"
c, d := 1 // ERROR "assignment mismatch: 2 variables but 1 values|wrong number of initializations"
e, f := 1, 2, 3 // ERROR "assignment mismatch: 2 variables but 3 values|wrong number of initializations"
}

View File

@ -10,8 +10,8 @@ package p
const (
_ = 1_ // ERROR "'_' must separate successive digits"
_ = 0b // ERROR "binary literal has no digits"
_ = 0o // ERROR "octal literal has no digits"
_ = 0x // ERROR "hexadecimal literal has no digits"
_ = 0b // ERROR "binary literal has no digits|invalid numeric literal"
_ = 0o // ERROR "octal literal has no digits|invalid numeric literal"
_ = 0x // ERROR "hexadecimal literal has no digits|invalid numeric literal"
_ = 0xde__ad // ERROR "'_' must separate successive digits"
)

View File

@ -9,14 +9,14 @@
package p
const x = 1i
const y = 1i < 2i // ERROR "invalid operation: .*not defined on untyped complex"
const z = x < 2i // ERROR "invalid operation: .*not defined on untyped complex"
const y = 1i < 2i // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
const z = x < 2i // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
func f() {
_ = 1i < 2i // ERROR "invalid operation: .*not defined on untyped complex"
_ = 1i < 2 // ERROR "invalid operation: .*not defined on untyped complex"
_ = 1 < 2i // ERROR "invalid operation: .*not defined on untyped complex"
_ = 1i < 2i // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
_ = 1i < 2 // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
_ = 1 < 2i // ERROR "invalid operation: .*not defined on untyped complex|non-ordered type"
c := 1i
_ = c < 2i // ERROR "invalid operation: .*not defined on complex128"
_ = c < 2i // ERROR "invalid operation: .*not defined on complex128|non-ordered type"
}

View File

@ -9,4 +9,4 @@
package p
var v uint
var x = []byte((1 << v) + 1) // ERROR "cannot convert"
var x = []byte((1 << v) + 1) // ERROR "cannot convert|non-integer type for left operand of shift"

View File

@ -11,19 +11,19 @@
package p
func _() {
go func() { // no error here about goroutine
send <-
}() // ERROR "expecting expression"
go func() { // no error here about goroutine
send <- // GCCGO_ERROR "undefined name"
}() // ERROR "expecting expression|expected operand"
}
func _() {
defer func() { // no error here about deferred function
1 +
}() // ERROR "expecting expression"
1 + // GCCGO_ERROR "value computed is not used"
}() // ERROR "expecting expression|expected operand"
}
func _() {
_ = (1 +) // ERROR "expecting expression"
_ = a[2 +] // ERROR "expecting expression"
_ = []int{1, 2, 3 + } // ERROR "expecting expression"
_ = (1 +) // ERROR "expecting expression|expected operand"
_ = a[2 +] // ERROR "expecting expression|expected operand|undefined name"
_ = []int{1, 2, 3 + } // ERROR "expecting expression|expected operand"
}

View File

@ -18,11 +18,11 @@ const iii int = 0x3
func f(v int) {
switch v {
case zero, one:
case two, one: // ERROR "previous case at LINE-1"
case two, one: // ERROR "previous case at LINE-1|duplicate case in switch"
case three:
case 3: // ERROR "previous case at LINE-1"
case iii: // ERROR "previous case at LINE-2"
case 3: // ERROR "previous case at LINE-1|duplicate case in switch"
case iii: // ERROR "previous case at LINE-2|duplicate case in switch"
}
}
@ -31,7 +31,7 @@ const b = "b"
var _ = map[string]int{
"a": 0,
b: 1,
"a": 2, // ERROR "previous key at LINE-2"
"b": 3, // ERROR "previous key at LINE-2"
"b": 4, // ERROR "previous key at LINE-3"
"a": 2, // ERROR "previous key at LINE-2|duplicate key in map literal"
"b": 3, // GC_ERROR "previous key at LINE-2"
"b": 4, // GC_ERROR "previous key at LINE-3"
}

View File

@ -10,5 +10,5 @@ package p
var s = []string{
1: "dup",
1: "dup", // ERROR "duplicate index in slice literal: 1"
1: "dup", // ERROR "duplicate index in slice literal: 1|duplicate value for index 1"
}

View File

@ -9,10 +9,10 @@ package p
type t struct{ x int }
func f1() {
t{}.M() // ERROR "t{}.M undefined \(type t has no field or method M\)"
t{x: 1}.M() // ERROR "t{...}.M undefined \(type t has no field or method M\)"
t{}.M() // ERROR "t{}.M undefined \(type t has no field or method M\)|undefined field or method .*M"
t{x: 1}.M() // ERROR "t{...}.M undefined \(type t has no field or method M\)|undefined field or method .*M"
}
func f2() (*t, error) {
return t{}.M() // ERROR "t{}.M undefined \(type t has no field or method M\)"
return t{}.M() // ERROR "t{}.M undefined \(type t has no field or method M\)|undefined field or method .*M|not enough arguments"
}

View File

@ -7,5 +7,5 @@
package p
func f() [2]int {
return [...]int{2: 0} // ERROR "cannot use \[\.\.\.\]int{...} \(type \[3\]int\)"
return [...]int{2: 0} // ERROR "cannot use \[\.\.\.\]int{...} \(type \[3\]int\)|incompatible type"
}

View File

@ -10,5 +10,5 @@ func f(...int) {}
func g() {
var x []int
f(x, x...) // ERROR "have \(\[\]int, \.\.\.int\)"
f(x, x...) // ERROR "have \(\[\]int, \.\.\.int\)|too many arguments"
}

View File

@ -13,8 +13,8 @@ type s struct {
func f() {
var x *s
_ = x == nil || len(x.slice) // ERROR "invalid operation: .+ \(operator \|\| not defined on int\)"
_ = len(x.slice) || x == nil // ERROR "invalid operation: .+ \(operator \|\| not defined on int\)"
_ = x == nil && len(x.slice) // ERROR "invalid operation: .+ \(operator && not defined on int\)"
_ = len(x.slice) && x == nil // ERROR "invalid operation: .+ \(operator && not defined on int\)"
_ = x == nil || len(x.slice) // ERROR "invalid operation: .+ \(operator \|\| not defined on int\)|incompatible types"
_ = len(x.slice) || x == nil // ERROR "invalid operation: .+ \(operator \|\| not defined on int\)|incompatible types"
_ = x == nil && len(x.slice) // ERROR "invalid operation: .+ \(operator && not defined on int\)|incompatible types"
_ = len(x.slice) && x == nil // ERROR "invalid operation: .+ \(operator && not defined on int\)|incompatible types"
}

View File

@ -6,31 +6,31 @@
package p
type T1 struct { // ERROR "invalid recursive type T1\n\tLINE: T1 refers to\n\tLINE+4: T2 refers to\n\tLINE: T1$"
type T1 struct { // ERROR "invalid recursive type T1\n\tLINE: T1 refers to\n\tLINE+4: T2 refers to\n\tLINE: T1$|invalid recursive type"
f2 T2
}
type T2 struct {
type T2 struct { // GCCGO_ERROR "invalid recursive type"
f1 T1
}
type a b
type b c // ERROR "invalid recursive type b\n\tLINE: b refers to\n\tLINE+1: c refers to\n\tLINE: b$"
type c b
type a b // GCCGO_ERROR "invalid recursive type"
type b c // ERROR "invalid recursive type b\n\tLINE: b refers to\n\tLINE+1: c refers to\n\tLINE: b$|invalid recursive type"
type c b // GCCGO_ERROR "invalid recursive type"
type d e
type e f
type f f // ERROR "invalid recursive type f\n\tLINE: f refers to\n\tLINE: f$"
type f f // ERROR "invalid recursive type f\n\tLINE: f refers to\n\tLINE: f$|invalid recursive type"
type g struct { // ERROR "invalid recursive type g\n\tLINE: g refers to\n\tLINE: g$"
type g struct { // ERROR "invalid recursive type g\n\tLINE: g refers to\n\tLINE: g$|invalid recursive type"
h struct {
g
}
}
type w x
type x y // ERROR "invalid recursive type x\n\tLINE: x refers to\n\tLINE+1: y refers to\n\tLINE+2: z refers to\n\tLINE: x$"
type y struct{ z }
type x y // ERROR "invalid recursive type x\n\tLINE: x refers to\n\tLINE+1: y refers to\n\tLINE+2: z refers to\n\tLINE: x$|invalid recursive type"
type y struct{ z } // GCCGO_ERROR "invalid recursive type"
type z [10]x
type w2 w // refer to the type loop again

View File

@ -6,8 +6,8 @@
package p
var c chan [2 << 16]byte // ERROR "channel element type too large"
var c chan [2 << 16]byte // GC_ERROR "channel element type too large"
type T [1 << 17]byte
var x chan T // ERROR "channel element type too large"
var x chan T // GC_ERROR "channel element type too large"

View File

@ -6,7 +6,7 @@
package p
var c chan [2 << 16]byte // ERROR "channel element type too large"
var c chan [2 << 16]byte // GC_ERROR "channel element type too large"
func f() {
_ = 42

View File

@ -7,28 +7,28 @@
package main
func foo() (int, int) {
return 2.3 // ERROR "not enough arguments to return\n\thave \(number\)\n\twant \(int, int\)"
return 2.3 // ERROR "not enough arguments to return\n\thave \(number\)\n\twant \(int, int\)|not enough arguments to return"
}
func foo2() {
return int(2), 2 // ERROR "too many arguments to return\n\thave \(int, number\)\n\twant \(\)"
return int(2), 2 // ERROR "too many arguments to return\n\thave \(int, number\)\n\twant \(\)|return with value in function with no return type"
}
func foo3(v int) (a, b, c, d int) {
if v >= 0 {
return 1 // ERROR "not enough arguments to return\n\thave \(number\)\n\twant \(int, int, int, int\)"
return 1 // ERROR "not enough arguments to return\n\thave \(number\)\n\twant \(int, int, int, int\)|not enough arguments to return"
}
return 2, 3 // ERROR "not enough arguments to return\n\thave \(number, number\)\n\twant \(int, int, int, int\)"
return 2, 3 // ERROR "not enough arguments to return\n\thave \(number, number\)\n\twant \(int, int, int, int\)|not enough arguments to return"
}
func foo4(name string) (string, int) {
switch name {
case "cow":
return "moo" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(string, int\)"
return "moo" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(string, int\)|not enough arguments to return"
case "dog":
return "dog", 10, true // ERROR "too many arguments to return\n\thave \(string, number, bool\)\n\twant \(string, int\)"
return "dog", 10, true // ERROR "too many arguments to return\n\thave \(string, number, bool\)\n\twant \(string, int\)|too many values in return statement"
case "fish":
return "" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(string, int\)"
return "" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(string, int\)|not enough arguments to return"
default:
return "lizard", 10
}
@ -40,14 +40,14 @@ type U float64
func foo5() (S, T, U) {
if false {
return "" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(S, T, U\)"
return "" // ERROR "not enough arguments to return\n\thave \(string\)\n\twant \(S, T, U\)|not enough arguments to return"
} else {
ptr := new(T)
return ptr // ERROR "not enough arguments to return\n\thave \(\*T\)\n\twant \(S, T, U\)"
return ptr // ERROR "not enough arguments to return\n\thave \(\*T\)\n\twant \(S, T, U\)|not enough arguments to return"
}
return new(S), 12.34, 1 + 0i, 'r', true // ERROR "too many arguments to return\n\thave \(\*S, number, number, number, bool\)\n\twant \(S, T, U\)"
return new(S), 12.34, 1 + 0i, 'r', true // ERROR "too many arguments to return\n\thave \(\*S, number, number, number, bool\)\n\twant \(S, T, U\)|too many values in return statement"
}
func foo6() (T, string) {
return "T", true, true // ERROR "too many arguments to return\n\thave \(string, bool, bool\)\n\twant \(T, string\)"
return "T", true, true // ERROR "too many arguments to return\n\thave \(string, bool, bool\)\n\twant \(T, string\)|too many values in return statement"
}

View File

@ -9,5 +9,5 @@
package p
func f() uintptr {
return nil // ERROR "cannot use nil as type uintptr in return argument"
return nil // ERROR "cannot use nil as type uintptr in return argument|incompatible type"
}

View File

@ -10,5 +10,5 @@ package p
import "syscall"
const A int = syscall.X // ERROR "undefined: syscall.X"
const B int = voidpkg.X // ERROR "undefined: voidpkg"
const A int = syscall.X // ERROR "undefined: syscall.X|undefined identifier .*syscall.X"
const B int = voidpkg.X // ERROR "undefined: voidpkg|undefined name .*voidpkg"

View File

@ -7,14 +7,14 @@
package p
func f1() {
for a, a := range []int{1, 2, 3} { // ERROR "a repeated on left side of :="
for a, a := range []int{1, 2, 3} { // ERROR "a.* repeated on left side of :="
println(a)
}
}
func f2() {
var a int
for a, a := range []int{1, 2, 3} { // ERROR "a repeated on left side of :="
for a, a := range []int{1, 2, 3} { // ERROR "a.* repeated on left side of :="
println(a)
}
println(a)

View File

@ -107,5 +107,5 @@ const (
f96 = f95 * 96
f97 = f96 * 97
f98 = f97 * 98
f99 = f98 * 99 // ERROR "overflow"
f99 = f98 * 99 // GC_ERROR "overflow"
)

View File

@ -7,5 +7,5 @@
package main
func main() {
_ = string(-4 + 2i + 2) // ERROR "-4 \+ 2i"
_ = string(-4 + 2i + 2) // ERROR "-4 \+ 2i|invalid type conversion"
}

View File

@ -15,7 +15,7 @@ func g() bool { return true }
func h(int, int) {}
func main() {
f(g()) // ERROR "in argument to f"
f(true) // ERROR "in argument to f"
h(true, true) // ERROR "in argument to h"
f(g()) // ERROR "in argument to f|incompatible type"
f(true) // ERROR "in argument to f|incompatible type"
h(true, true) // ERROR "in argument to h|incompatible type"
}

View File

@ -9,9 +9,9 @@
package main
func main() {
_ = [0]int{-1: 50} // ERROR "index must be non-negative integer constant"
_ = [0]int{0: 0} // ERROR "index 0 out of bounds \[0:0\]"
_ = [0]int{5: 25} // ERROR "index 5 out of bounds \[0:0\]"
_ = [10]int{2: 10, 15: 30} // ERROR "index 15 out of bounds \[0:10\]"
_ = [10]int{5: 5, 1: 1, 12: 12} // ERROR "index 12 out of bounds \[0:10\]"
_ = [0]int{-1: 50} // ERROR "index must be non-negative integer constant|index expression is negative"
_ = [0]int{0: 0} // ERROR "index 0 out of bounds \[0:0\]|out of range"
_ = [0]int{5: 25} // ERROR "index 5 out of bounds \[0:0\]|out of range"
_ = [10]int{2: 10, 15: 30} // ERROR "index 15 out of bounds \[0:10\]|out of range"
_ = [10]int{5: 5, 1: 1, 12: 12} // ERROR "index 12 out of bounds \[0:10\]|out of range"
}

View File

@ -8,4 +8,4 @@
package p
var _ = []int{a: true, true} // ERROR "undefined: a" "cannot use true \(type untyped bool\) as type int in slice literal"
var _ = []int{a: true, true} // ERROR "undefined: a" "cannot use true \(type untyped bool\) as type int in slice literal|undefined name .*a|incompatible type"

View File

@ -9,7 +9,7 @@
package main
func main() {
_ = copy(nil, []int{}) // ERROR "use of untyped nil"
_ = copy([]int{}, nil) // ERROR "use of untyped nil"
_ = 1 + true // ERROR "mismatched types untyped int and untyped bool"
_ = copy(nil, []int{}) // ERROR "use of untyped nil|left argument must be a slice"
_ = copy([]int{}, nil) // ERROR "use of untyped nil|second argument must be slice or string"
_ = 1 + true // ERROR "mismatched types untyped int and untyped bool|incompatible types"
}

View File

@ -11,5 +11,5 @@ package p
func f() {
_:
_:
goto _ // ERROR "not defined"
goto _ // ERROR "not defined|undefined label"
}

View File

@ -13,12 +13,12 @@ func f(string, int, float64, string)
func g(string, int, float64, ...string)
func main() {
f(1, 0.5, "hello") // ERROR "not enough arguments"
f(1, 0.5, "hello") // ERROR "not enough arguments|incompatible type"
f("1", 2, 3.1, "4")
f(1, 0.5, "hello", 4, 5) // ERROR "too many arguments"
g(1, 0.5) // ERROR "not enough arguments"
f(1, 0.5, "hello", 4, 5) // ERROR "too many arguments|incompatible type"
g(1, 0.5) // ERROR "not enough arguments|incompatible type"
g("1", 2, 3.1)
g(1, 0.5, []int{3, 4}...) // ERROR "not enough arguments"
g(1, 0.5, []int{3, 4}...) // ERROR "not enough arguments|incompatible type"
g("1", 2, 3.1, "4", "5")
g(1, 0.5, "hello", 4, []int{5, 6}...) // ERROR "too many arguments"
g(1, 0.5, "hello", 4, []int{5, 6}...) // ERROR "too many arguments|truncated to integer"
}

View File

@ -10,7 +10,7 @@ const (
c0 = 1 << 100
c1 = c0 * c0
c2 = c1 * c1
c3 = c2 * c2 // ERROR "overflow"
c3 = c2 * c2 // GC_ERROR "overflow"
c4 = c3 * c3
c5 = c4 * c4
c6 = c5 * c5
@ -21,7 +21,7 @@ const (
c11 = c10 * c10
c12 = c11 * c11
c13 = c12 * c12
c14 = c13 * c13
c14 = c13 * c13 // GCCGO_ERROR "overflow"
c15 = c14 * c14
c16 = c15 * c15
c17 = c16 * c16

View File

@ -12,14 +12,14 @@ import "unsafe"
type myPointer unsafe.Pointer
const _ = unsafe.Pointer(uintptr(1)) // ERROR "is not (a )?constant"
const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant"
const _ = unsafe.Pointer(uintptr(1)) // ERROR "is not (a )?constant|invalid constant type"
const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant|invalid constant type"
const _ = (*int)(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant"
const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant"
const _ = (*int)(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant|invalid constant type"
const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant|invalid constant type"
const _ = uintptr(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant"
const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant"
const _ = uintptr(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant|expression is not constant"
const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant|expression is no constant"
const _ = []byte("") // ERROR "is not (a )?constant"
const _ = []rune("") // ERROR "is not (a )?constant"
const _ = []byte("") // ERROR "is not (a )?constant|invalid constant type"
const _ = []rune("") // ERROR "is not (a )?constant|invalid constant type"

View File

@ -11,6 +11,6 @@ package p
func f() {
var x []byte
x++ // ERROR "invalid operation: x[+][+]"
x++ // ERROR "invalid operation: x[+][+]|non-numeric type"
}

View File

@ -27,16 +27,16 @@ func (t T) M(x 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|incompatible type|not enough arguments"
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"
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"
g()() // ERROR "not enough arguments in call to g\(\)|not enough arguments"
f() // ERROR "not enough arguments in call to f|not enough arguments"
i.M() // ERROR "not enough arguments in call to i\.M|not enough arguments"
I.M() // ERROR "not enough arguments in call to method expression I\.M|not enough arguments"
t.M() // ERROR "not enough arguments in call to t\.M|not enough arguments"
T.M() // ERROR "not enough arguments in call to method expression T\.M|not enough arguments"
(*T).M() // ERROR "not enough arguments in call to method expression \(\*T\)\.M|not enough arguments"
}

View File

@ -10,8 +10,8 @@
package main
func main() {
_ = []byte{"foo"} // ERROR "cannot use"
_ = []int{"foo"} // ERROR "cannot use"
_ = []rune{"foo"} // ERROR "cannot use"
_ = []byte{"foo"} // ERROR "cannot use|incompatible type"
_ = []int{"foo"} // ERROR "cannot use|incompatible type"
_ = []rune{"foo"} // ERROR "cannot use|incompatible type"
_ = []string{"foo"} // OK
}

View File

@ -7,5 +7,5 @@
package main
func main() {
n.foo = 6 // ERROR "undefined: n in n.foo"
n.foo = 6 // ERROR "undefined: n in n.foo|undefined name .*n"
}

View File

@ -9,7 +9,7 @@
package p
type T struct{ T } // ERROR "invalid recursive type T"
type T struct{ T } // ERROR "invalid recursive type .*T"
func f() {
println(T{} == T{})

View File

@ -13,6 +13,6 @@ func f() (_, _ []int) { return }
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|incompatible type"
_ = append(g()) // ERROR "cannot use float64 value as type int in append|incompatible type"
}