]> Cypherpunks repositories - gostls13.git/commitdiff
test: match gofrontend error messages
authorIan Lance Taylor <iant@golang.org>
Thu, 26 Nov 2020 20:26:02 +0000 (12:26 -0800)
committerIan Lance Taylor <iant@golang.org>
Sat, 28 Nov 2020 02:31:54 +0000 (02:31 +0000)
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>
18 files changed:
test/blank1.go
test/chan/perm.go
test/complit1.go
test/convlit.go
test/ddd1.go
test/fixedbugs/bug176.go
test/fixedbugs/bug332.go
test/fixedbugs/issue4232.go
test/fixedbugs/issue4458.go
test/fixedbugs/issue5172.go
test/init.go
test/initializerr.go
test/interface/explicit.go
test/label.go
test/label1.go
test/map1.go
test/method2.go
test/syntax/chan1.go

index c9a8e6a290497152756676866e014f334652f818..70e01b1a307fd96409b0052794938ced33f866f6 100644 (file)
@@ -13,7 +13,7 @@ var t struct {
        _ int
 }
 
-func (x int) _() { // ERROR "cannot define new methods on non-local type"
+func (x int) _() { // ERROR "methods on non-local type"
        println(x)
 }
 
index 7da88bdae8a9c737903f607d2fd31d689f9ae52e..0c96d921d1ea303bb1d78240cf3ccf97d8b02e04 100644 (file)
@@ -25,8 +25,8 @@ func main() {
        cs = cr // ERROR "illegal types|incompatible|cannot"
 
        var n int
-       <-n    // ERROR "receive from non-chan"
-       n <- 2 // ERROR "send to non-chan"
+       <-n    // ERROR "receive from non-chan|expected channel"
+       n <- 2 // ERROR "send to non-chan|must be channel"
 
        c <- 0       // ok
        <-c          // ok
@@ -66,5 +66,5 @@ func main() {
        close(c)
        close(cs)
        close(cr) // ERROR "receive"
-       close(n)  // ERROR "invalid operation.*non-chan type"
+       close(n)  // ERROR "invalid operation.*non-chan type|must be channel"
 }
index eb0f920fcbde0d20616b6630f7b7f32978735687..7c2a4e2996d5160a8500a1a3a139f8de156a21c3 100644 (file)
@@ -22,9 +22,9 @@ var (
        _ = m[0][:]            // ERROR "slice of unaddressable value"
        _ = f()[:]             // ERROR "slice of unaddressable value"
 
-       _ = 301[:]  // ERROR "cannot slice"
-       _ = 3.1[:]  // ERROR "cannot slice"
-       _ = true[:] // ERROR "cannot slice"
+       _ = 301[:]  // ERROR "cannot slice|attempt to slice object that is not"
+       _ = 3.1[:]  // ERROR "cannot slice|attempt to slice object that is not"
+       _ = true[:] // ERROR "cannot slice|attempt to slice object that is not"
 
        // these are okay because they are slicing a pointer to an array
        _ = (&[3]int{1, 2, 3})[:]
@@ -46,8 +46,8 @@ var (
        _ = &T{0, 0, "", nil}               // ok
        _ = &T{i: 0, f: 0, s: "", next: {}} // ERROR "missing type in composite literal|omit types within composite literal"
        _ = &T{0, 0, "", {}}                // ERROR "missing type in composite literal|omit types within composite literal"
-       _ = TP{i: 0, f: 0, s: "", next: {}} // ERROR "invalid composite literal type TP"
-       _ = &Ti{}                           // ERROR "invalid composite literal type Ti"
+       _ = TP{i: 0, f: 0, s: "", next: {}} // ERROR "invalid composite literal type TP|omit types within composite literal"
+       _ = &Ti{}                           // ERROR "invalid composite literal type Ti|expected.*type for composite literal"
 )
 
 type M map[T]T
index de760542da46e0119695fdbe3d9ffb203714c7ee..1c66c89e8800757618a80a0a120b9106584661a3 100644 (file)
@@ -21,9 +21,9 @@ var x6 = int(1e100)      // ERROR "overflow"
 var x7 = float32(1e1000) // ERROR "overflow"
 
 // unsafe.Pointer can only convert to/from uintptr
-var _ = string(unsafe.Pointer(uintptr(65)))  // ERROR "convert"
-var _ = float64(unsafe.Pointer(uintptr(65))) // ERROR "convert"
-var _ = int(unsafe.Pointer(uintptr(65)))     // ERROR "convert"
+var _ = string(unsafe.Pointer(uintptr(65)))  // ERROR "convert|conversion"
+var _ = float64(unsafe.Pointer(uintptr(65))) // ERROR "convert|conversion"
+var _ = int(unsafe.Pointer(uintptr(65)))     // ERROR "convert|conversion"
 
 // implicit conversions merit scrutiny
 var s string
index 9857814648ba187090f59a181e4c169bdb36beba..01b9c0eadb2e821c108f6bf82babf35f3d4c2b4d 100644 (file)
@@ -60,5 +60,5 @@ func bad(args ...int) {
        _ = [...]byte("foo") // ERROR "[.][.][.]"
        _ = [...][...]int{{1,2,3},{4,5,6}}      // ERROR "[.][.][.]"
 
-       Foo(x...) // ERROR "invalid use of [.][.][.] in call"
+       Foo(x...) // ERROR "invalid use of .*[.][.][.]"
 }
index ea3a9097477dc7b1238f43e311061da389e9d9ba..7001dd081e9ab0c7e23655f081e1105d1ffd726f 100644 (file)
@@ -9,6 +9,6 @@ package main
 var x int
 
 var a = []int{ x: 1}   // ERROR "constant"
-var b = [...]int{x: 1}
+var b = [...]int{x: 1} // GCCGO_ERROR "constant"
 var c = map[int]int{ x: 1}
 
index d43c2ddcff5981f5854057e9b60a6bc0741b7ff1..159c8b4e68b89c9b3317ce8b0a5fe05f86eaa5c2 100644 (file)
@@ -14,4 +14,4 @@ func main() {}
 
 // important: no newline on end of next line.
 // 6g used to print <epoch> instead of bug332.go:111
-func (t *T) F() {} // ERROR "undefinedT"
\ No newline at end of file
+func (t *T) F() {} // ERROR "undefined.*T"
\ No newline at end of file
index 935f3820c690ff9f6f65b03bc0e94fc411f2d4d9..30d132683a981a4d464c2b9666f7fca55f5e69c8 100644 (file)
@@ -19,7 +19,7 @@ func f() {
        _ = a[10:10]
        _ = a[9:12]            // ERROR "invalid slice index 12|index out of bounds"
        _ = a[11:12]           // ERROR "invalid slice index 11|index out of bounds"
-       _ = a[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
+       _ = a[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
 
        var s []int
        _ = s[-1]  // ERROR "invalid slice index -1|index out of bounds"
@@ -30,7 +30,7 @@ func f() {
        _ = s[10:10]
        _ = s[9:12]
        _ = s[11:12]
-       _ = s[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
+       _ = s[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
 
        const c = "foofoofoof"
        _ = c[-1]  // ERROR "invalid string index -1|index out of bounds"
@@ -41,7 +41,7 @@ func f() {
        _ = c[10:10]
        _ = c[9:12]            // ERROR "invalid slice index 12|index out of bounds"
        _ = c[11:12]           // ERROR "invalid slice index 11|index out of bounds"
-       _ = c[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
+       _ = c[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
 
        var t string
        _ = t[-1]  // ERROR "invalid string index -1|index out of bounds"
@@ -52,5 +52,5 @@ func f() {
        _ = t[10:10]
        _ = t[9:12]
        _ = t[11:12]
-       _ = t[1<<100 : 1<<110] // ERROR "overflows int" "invalid slice index 1 << 100|index out of bounds"
+       _ = t[1<<100 : 1<<110] // ERROR "overflows int|integer constant overflow" "invalid slice index 1 << 100|index out of bounds"
 }
index 98ffea79dc443bc14fb5125d5b20d3743aa35900..59cfa9fcee811063a2f6706ae7281f748b6749b8 100644 (file)
@@ -16,5 +16,5 @@ func (T) foo() {}
 func main() {
        av := T{}
        pav := &av
-       (**T).foo(&pav) // ERROR "no method foo|requires named type or pointer to named"
+       (**T).foo(&pav) // ERROR "no method .*foo|requires named type or pointer to named"
 }
index 0339935b647ace031fd736763aa48f7e5305fe2b..ed92ac6ff2bb66c1b961ac598cc5763fb1b34b10 100644 (file)
@@ -21,6 +21,6 @@ func main() {
        go f.bar()    // ERROR "undefined"
        defer f.bar() // ERROR "undefined"
 
-       t := T{1} // ERROR "too many values"
+       t := T{1} // ERROR "too many"
        go t.Bar()
 }
index 317f2472cb82c3cb6990f37f3e5a33f660626404..5e182281da8ca32018ef1c45e4780ca8e798c425 100644 (file)
@@ -14,6 +14,6 @@ func init() {
 
 func main() {
        init()         // ERROR "undefined.*init"
-       runtime.init() // ERROR "undefined.*runtime\.init"
+       runtime.init() // ERROR "undefined.*runtime\.init|reference to undefined name"
        var _ = init   // ERROR "undefined.*init"
 }
index 990ab60f96b0065bf6c46d4020242f03e8cdb2f8..5e2e9a91a0b2fd75b3ad69014a77dac8de3502e8 100644 (file)
@@ -23,7 +23,7 @@ var a2 = S { Y: 3, Z: 2, Y: 3 } // ERROR "duplicate"
 var a3 = T { S{}, 2, 3, 4, 5, 6 }      // ERROR "convert|too many"
 var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }      // ERROR "index|too many"
 var a5 = []byte { x: 2 }       // ERROR "index"
-var a6 = []byte{1: 1, 2: 2, 1: 3}      // ERROR "duplicate index"
+var a6 = []byte{1: 1, 2: 2, 1: 3}      // ERROR "duplicate"
 
 var ok1 = S { }        // should be ok
 var ok2 = T { S: ok1 } // should be ok
index 1fb3b6a05a2c4d91d6a7d027e5a3df635081e9ce..3f9451e8d2faa1f34d8f0dda4c780a8ccaf44d10 100644 (file)
@@ -57,7 +57,7 @@ func main() {
 
        // cannot type-assert non-interfaces
        f := 2.0
-       _ = f.(int) // ERROR "non-interface type"
+       _ = f.(int) // ERROR "non-interface type|only valid for interface types"
 
 }
 
index 11716cc2c5d669d9e461aa0313b91fca5b3a387d..7deead6fba9053367c67febd39a61bbb19a27a2f 100644 (file)
@@ -61,5 +61,5 @@ L10:
 
        goto L10
 
-       goto go2 // ERROR "label go2 not defined"
+       goto go2 // ERROR "label go2 not defined|reference to undefined label .*go2"
 }
index b2e0ef09b8ece2a52c5d16d2eb6a786cf6c20488..a8eaecbff2fa0a50f0af0dabe807aafee7022825 100644 (file)
@@ -15,11 +15,11 @@ var x int
 func f1() {
        switch x {
        case 1:
-               continue // ERROR "continue is not in a loop$"
+               continue // ERROR "continue is not in a loop$|continue statement not within for"
        }
        select {
        default:
-               continue // ERROR "continue is not in a loop$"
+               continue // ERROR "continue is not in a loop$|continue statement not within for"
        }
 
 }
@@ -103,14 +103,14 @@ L5:
                }
        }
 
-       continue // ERROR "continue is not in a loop$"
+       continue // ERROR "continue is not in a loop$|continue statement not within for"
        for {
-               continue on // ERROR "continue label not defined: on"
+               continue on // ERROR "continue label not defined: on|invalid continue label .*on"
        }
 
-       break // ERROR "break is not in a loop, switch, or select"
+       break // ERROR "break is not in a loop, switch, or select|break statement not within for or switch or select"
        for {
-               break dance // ERROR "break label not defined: dance"
+               break dance // ERROR "break label not defined: dance|invalid break label .*dance"
        }
 
        for {
index 498c2ec45bd88c717d68d37b23dbfc97d3aafb4d..b4aa70755feb0ed88f43a9b8a3c50dd6ad1d3e83 100644 (file)
@@ -61,8 +61,8 @@ type T8 struct { F *T7 }
 
 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"
-}
\ No newline at end of file
+       delete(1, m)    // ERROR "first argument to delete must be map|argument 1 must be a map"
+}
index a45a943156ffab6fa7e106bf3beffe9c4a19c4ff..7feb6750555079f243d4bd5c0b1912b9b203710d 100644 (file)
@@ -33,9 +33,9 @@ var _ = (*Val).val // ERROR "method"
 var v Val
 var pv = &v
 
-var _ = pv.val() // ERROR "pv.val undefined"
-var _ = pv.val   // ERROR "pv.val undefined"
+var _ = pv.val() // ERROR "undefined"
+var _ = pv.val   // ERROR "undefined"
 
 func (t *T) g() int { return t.a }
 
-var _ = (T).g() // ERROR "needs pointer receiver|undefined"
+var _ = (T).g() // ERROR "needs pointer receiver|undefined|method requires pointer"
index 56103d1d79ef6b7e7fdfc2126f005748c0a88731..88a5b4777b8e8d5b3cacf3945a8b4371f6a0bf1a 100644 (file)
@@ -10,8 +10,8 @@ var c chan int
 var v int
 
 func main() {
-       if c <- v { // ERROR "cannot use c <- v as value"
+       if c <- v { // ERROR "cannot use c <- v as value|send statement used as value"
        }
 }
 
-var _ = c <- v // ERROR "unexpected <-"
+var _ = c <- v // ERROR "unexpected <-|send statement used as value"