Skip to content

Commit b94346e

Browse files
test: match gofrontend error messages
These changes match the following gofrontend error messages: blank1.go:16:1: error: may not define methods on non-local type chan/perm.go:28:9: error: expected channel chan/perm.go:29:11: error: left operand of ‘<-’ must be channel chan/perm.go:69:9: error: argument must be channel complit1.go:25:16: error: attempt to slice object that is not array, slice, or string complit1.go:26:16: error: attempt to slice object that is not array, slice, or string complit1.go:27:17: error: attempt to slice object that is not array, slice, or string complit1.go:49:41: error: may only omit types within composite literals of slice, array, or map type complit1.go:50:14: error: expected struct, slice, array, or map type for composite literal convlit.go:24:9: error: invalid type conversion (cannot use type unsafe.Pointer as type string) convlit.go:25:9: error: invalid type conversion (cannot use type unsafe.Pointer as type float64) convlit.go:26:9: error: invalid type conversion (cannot use type unsafe.Pointer as type int) ddd1.go:63:9: error: invalid use of ‘...’ calling non-variadic function fixedbugs/bug176.go:12:18: error: index expression is not integer constant fixedbugs/bug332.go:17:10: error: use of undefined type ‘T’ fixedbugs/issue4232.go:22:16: error: integer constant overflow fixedbugs/issue4232.go:33:16: error: integer constant overflow fixedbugs/issue4232.go:44:25: error: integer constant overflow fixedbugs/issue4232.go:55:16: error: integer constant overflow fixedbugs/issue4458.go:19:14: error: type has no method ‘foo’ fixedbugs/issue5172.go:24:14: error: too many expressions for struct init.go:17:9: error: reference to undefined name ‘runtime’ initializerr.go:26:29: error: duplicate value for index 1 interface/explicit.go:60:14: error: type assertion only valid for interface types label.go:64:9: error: reference to undefined label ‘go2’ label1.go:18:97: error: continue statement not within for label1.go:22:97: error: continue statement not within for label1.go:106:89: error: continue statement not within for label1.go:108:26: error: invalid continue label ‘on’ label1.go:111:118: error: break statement not within for or switch or select label1.go:113:23: error: invalid break label ‘dance’ map1.go:64:9: error: not enough arguments map1.go:65:9: error: not enough arguments map1.go:67:9: error: argument 1 must be a map method2.go:36:11: error: reference to undefined field or method ‘val’ method2.go:37:11: error: reference to undefined field or method ‘val’ method2.go:41:12: error: method requires pointer (use ‘(*T).g’) syntax/chan1.go:13:19: error: send statement used as value; use select for non-blocking send syntax/chan1.go:17:11: error: send statement used as value; use select for non-blocking send Change-Id: I98047b60a376e3d2788836300f7fcac3f2c285cb Reviewed-on: https://go-review.googlesource.com/c/go/+/273527 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>
1 parent cb84d83 commit b94346e

File tree

18 files changed

+40
-40
lines changed

18 files changed

+40
-40
lines changed

test/blank1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var t struct {
1313
_ int
1414
}
1515

16-
func (x int) _() { // ERROR "cannot define new methods on non-local type"
16+
func (x int) _() { // ERROR "methods on non-local type"
1717
println(x)
1818
}
1919

test/chan/perm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func main() {
2525
cs = cr // ERROR "illegal types|incompatible|cannot"
2626

2727
var n int
28-
<-n // ERROR "receive from non-chan"
29-
n <- 2 // ERROR "send to non-chan"
28+
<-n // ERROR "receive from non-chan|expected channel"
29+
n <- 2 // ERROR "send to non-chan|must be channel"
3030

3131
c <- 0 // ok
3232
<-c // ok
@@ -66,5 +66,5 @@ func main() {
6666
close(c)
6767
close(cs)
6868
close(cr) // ERROR "receive"
69-
close(n) // ERROR "invalid operation.*non-chan type"
69+
close(n) // ERROR "invalid operation.*non-chan type|must be channel"
7070
}

test/complit1.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ var (
2222
_ = m[0][:] // ERROR "slice of unaddressable value"
2323
_ = f()[:] // ERROR "slice of unaddressable value"
2424

25-
_ = 301[:] // ERROR "cannot slice"
26-
_ = 3.1[:] // ERROR "cannot slice"
27-
_ = true[:] // ERROR "cannot slice"
25+
_ = 301[:] // ERROR "cannot slice|attempt to slice object that is not"
26+
_ = 3.1[:] // ERROR "cannot slice|attempt to slice object that is not"
27+
_ = true[:] // ERROR "cannot slice|attempt to slice object that is not"
2828

2929
// these are okay because they are slicing a pointer to an array
3030
_ = (&[3]int{1, 2, 3})[:]
@@ -46,8 +46,8 @@ var (
4646
_ = &T{0, 0, "", nil} // ok
4747
_ = &T{i: 0, f: 0, s: "", next: {}} // ERROR "missing type in composite literal|omit types within composite literal"
4848
_ = &T{0, 0, "", {}} // ERROR "missing type in composite literal|omit types within composite literal"
49-
_ = TP{i: 0, f: 0, s: "", next: {}} // ERROR "invalid composite literal type TP"
50-
_ = &Ti{} // ERROR "invalid composite literal type Ti"
49+
_ = TP{i: 0, f: 0, s: "", next: {}} // ERROR "invalid composite literal type TP|omit types within composite literal"
50+
_ = &Ti{} // ERROR "invalid composite literal type Ti|expected.*type for composite literal"
5151
)
5252

5353
type M map[T]T

test/convlit.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ var x6 = int(1e100) // ERROR "overflow"
2121
var x7 = float32(1e1000) // ERROR "overflow"
2222

2323
// unsafe.Pointer can only convert to/from uintptr
24-
var _ = string(unsafe.Pointer(uintptr(65))) // ERROR "convert"
25-
var _ = float64(unsafe.Pointer(uintptr(65))) // ERROR "convert"
26-
var _ = int(unsafe.Pointer(uintptr(65))) // ERROR "convert"
24+
var _ = string(unsafe.Pointer(uintptr(65))) // ERROR "convert|conversion"
25+
var _ = float64(unsafe.Pointer(uintptr(65))) // ERROR "convert|conversion"
26+
var _ = int(unsafe.Pointer(uintptr(65))) // ERROR "convert|conversion"
2727

2828
// implicit conversions merit scrutiny
2929
var s string

test/ddd1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ func bad(args ...int) {
6060
_ = [...]byte("foo") // ERROR "[.][.][.]"
6161
_ = [...][...]int{{1,2,3},{4,5,6}} // ERROR "[.][.][.]"
6262

63-
Foo(x...) // ERROR "invalid use of [.][.][.] in call"
63+
Foo(x...) // ERROR "invalid use of .*[.][.][.]"
6464
}

test/fixedbugs/bug176.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ package main
99
var x int
1010

1111
var a = []int{ x: 1} // ERROR "constant"
12-
var b = [...]int{x: 1}
12+
var b = [...]int{x: 1} // GCCGO_ERROR "constant"
1313
var c = map[int]int{ x: 1}
1414

test/fixedbugs/bug332.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ func main() {}
1414

1515
// important: no newline on end of next line.
1616
// 6g used to print <epoch> instead of bug332.go:111
17-
func (t *T) F() {} // ERROR "undefined: T"
17+
func (t *T) F() {} // ERROR "undefined.*T"

test/fixedbugs/issue4232.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func f() {
1919
_ = a[10:10]
2020
_ = a[9:12] // ERROR "invalid slice index 12|index out of bounds"
2121
_ = a[11:12] // ERROR "invalid slice index 11|index out of bounds"
22-
_ = a[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
22+
_ = a[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
2323

2424
var s []int
2525
_ = s[-1] // ERROR "invalid slice index -1|index out of bounds"
@@ -30,7 +30,7 @@ func f() {
3030
_ = s[10:10]
3131
_ = s[9:12]
3232
_ = s[11:12]
33-
_ = s[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
33+
_ = s[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
3434

3535
const c = "foofoofoof"
3636
_ = c[-1] // ERROR "invalid string index -1|index out of bounds"
@@ -41,7 +41,7 @@ func f() {
4141
_ = c[10:10]
4242
_ = c[9:12] // ERROR "invalid slice index 12|index out of bounds"
4343
_ = c[11:12] // ERROR "invalid slice index 11|index out of bounds"
44-
_ = c[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
44+
_ = c[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
4545

4646
var t string
4747
_ = t[-1] // ERROR "invalid string index -1|index out of bounds"
@@ -52,5 +52,5 @@ func f() {
5252
_ = t[10:10]
5353
_ = t[9:12]
5454
_ = t[11:12]
55-
_ = t[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
55+
_ = t[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
5656
}

test/fixedbugs/issue4458.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ func (T) foo() {}
1616
func main() {
1717
av := T{}
1818
pav := &av
19-
(**T).foo(&pav) // ERROR "no method foo|requires named type or pointer to named"
19+
(**T).foo(&pav) // ERROR "no method .*foo|requires named type or pointer to named"
2020
}

test/fixedbugs/issue5172.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ func main() {
2121
go f.bar() // ERROR "undefined"
2222
defer f.bar() // ERROR "undefined"
2323

24-
t := T{1} // ERROR "too many values"
24+
t := T{1} // ERROR "too many"
2525
go t.Bar()
2626
}

0 commit comments

Comments
 (0)