]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] test: adjust more test cases to match compiler -G output
authorRobert Griesemer <gri@golang.org>
Wed, 2 Dec 2020 01:37:12 +0000 (17:37 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 3 Dec 2020 17:55:56 +0000 (17:55 +0000)
With this CL, the first ~500 errorcheck tests pass when running

go run run.go -v -G

in the $GOROOT/test directory (the log output includes a few dozen
tests that are currently skipped).

Change-Id: I9eaa2319fb39a090df54f8699ddc29ffe58b1bf1
Reviewed-on: https://go-review.googlesource.com/c/go/+/274975
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
21 files changed:
test/chan/perm.go
test/fixedbugs/bug040.go
test/fixedbugs/bug062.go
test/fixedbugs/bug081.go
test/fixedbugs/bug090.go
test/fixedbugs/bug122.go
test/fixedbugs/bug131.go
test/fixedbugs/bug132.go
test/fixedbugs/bug13343.go
test/fixedbugs/bug175.go
test/fixedbugs/bug205.go
test/fixedbugs/bug215.go
test/fixedbugs/bug223.go
test/fixedbugs/bug224.go
test/fixedbugs/bug280.go
test/fixedbugs/bug289.go
test/interface/embed2.go
test/interface/explicit.go
test/interface/pointer.go
test/interface/receiver1.go
test/run.go

index 7da88bdae8a9c737903f607d2fd31d689f9ae52e..607a356a02a5d93145871d92977afce80f31b945 100644 (file)
@@ -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|not a channel"
 }
index d2cf88afcb24ff04a9c2f6514c731a7ed174bdd7..5c3a1d7c129ba8c6019819fda94aba4ddd527c97 100644 (file)
@@ -7,5 +7,5 @@
 package main
 
 func f (x,             // GCCGO_ERROR "previous"
-       x int) {        // ERROR "duplicate argument|redefinition"
+       x int) {        // ERROR "duplicate argument|redefinition|redeclared"
 }
index 1cc50036559d661000ab187dff72c3e48e207387..24c2dff9339a689b749f5ac79046a53d7880db68 100644 (file)
@@ -8,4 +8,5 @@ package main
 
 func main() {
        var s string = nil;     // ERROR "illegal|invalid|incompatible|cannot"
+       _ = s
 }
index c25d2883704945e5cfa988ed9dc0ddda639222ad..40e6dd1b6f129a1a2b91ef00d7fe0319c7fd98e6 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-const x x = 2 // ERROR "loop|type"
+const x x = 2 // ERROR "loop|type|cycle"
 
 /*
 bug081.go:3: first constant must evaluate an expression
index 320bd57f5c17fb9cf6ff0b17f598a02ac6c9af9a..6d30cca017b7467116c8680f0980569f501cdc70 100644 (file)
@@ -42,5 +42,5 @@ func main() {
 
        const h float64 = 3.14;
        i = h;  // ERROR "convert|incompatible|cannot"
-       i = int(h);     // ERROR "truncate"
+       i = int(h);     // ERROR "truncate|cannot convert"
 }
index fb4eb9f3adebed21309c3940a568e071c181a088..5640cf263a8e8a6e4baaf863c43560f94b56987f 100644 (file)
@@ -8,5 +8,5 @@ package main
 
 func main() {
        // should allow at most 2 sizes
-       a := make([]int, 10, 20, 30, 40); // ERROR "too many"
+       a := make([]int, 10, 20, 30, 40); // ERROR "too many|expects 2 or 3 arguments; found 5"
 }
index 0ebbd26069e16ba2f2e57abcd27cbcf874f66b98..2c9d120ed069bf7b4a74984a999123ab641ebc3b 100644 (file)
@@ -9,4 +9,5 @@ package main
 func main() {
        const a uint64 = 10;
        var b int64 = a;        // ERROR "convert|cannot|incompatible"
+       _ = b
 }
index e334566c79b9c157fab2d7b3f3e70e84a229d61d..b75e8338de213006087e81fde6125604b6bf9ecb 100644 (file)
@@ -7,5 +7,5 @@
 package main
 
 type T struct {
-       x, x int  // ERROR "duplicate"
+       x, x int  // ERROR "duplicate|redeclared"
 }
index 5dc736d443b949225f8e3070e8ec86c4493a6efc..08a306277bec332d1d0f0437eb94ebf427b844f5 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 var (
-       a, b = f() // ERROR "initialization loop|depends upon itself"
+       a, b = f() // ERROR "initialization loop|depends upon itself|initialization cycle"
        c    = b
 )
 
index 5fca4b22bc5539ba3f91f580d232aacab90292a5..88210a59b3e520c780f47cd0a1738b31f57684f0 100644 (file)
@@ -9,6 +9,6 @@ package main
 func f() (int, bool) { return 0, true }
 
 func main() {
-       x, y := f(), 2; // ERROR "multi"
+       x, y := f(), 2; // ERROR "multi|2-valued"
        _, _ = x, y
 }
index 1e0d9d1f34d62f554d4ab1c4413da85be2259af0..789696df0cc9cd548e63ad6f9510ee836513e5c7 100644 (file)
@@ -11,8 +11,8 @@ var s string;
 var m map[string]int;
 
 func main() {
-       println(t["hi"]); // ERROR "non-integer slice index|must be integer"
-       println(s["hi"]); // ERROR "non-integer string index|must be integer"
-       println(m[0]);    // ERROR "cannot use.*as type string"
+       println(t["hi"]); // ERROR "non-integer slice index|must be integer|cannot convert"
+       println(s["hi"]); // ERROR "non-integer string index|must be integer|cannot convert"
+       println(m[0]);    // ERROR "cannot use.*as type string|cannot convert"
 }
 
index b27cc7db1a91620bf6804de1d4d59fab6029a05a..5546d0c8899185bec6ee8e5fc9c9bd4823c0267d 100644 (file)
@@ -9,6 +9,6 @@
 
 package main
 
-type A struct {        a A }   // ERROR "recursive"
+type A struct {        a A }   // ERROR "recursive|cycle"
 func foo()             { new(A).bar() }
 func (a A) bar()       {}
index 29ae53cb713c45ab97aefb2bc029bf57a5c49589..50082cbab1beeed5522803a4cb5ee08831bba05c 100644 (file)
@@ -18,4 +18,4 @@ func f() {
        }
 }
 
-var m = map[string]F{"f": f} // ERROR "initialization loop|depends upon itself"
+var m = map[string]F{"f": f} // ERROR "initialization loop|depends upon itself|initialization cycle"
index d2fd67cf32f3fbff347ff4e81987c74a95378fe8..4ff83019df05c2a4348f4fba0bde28504ab27d4d 100644 (file)
@@ -6,5 +6,5 @@
 
 package main
 
-type T T               // ERROR "recursive"
+type T T               // ERROR "recursive|cycle"
 
index afec57f037ad6ba7fd401347b32fce52951a166f..9a9d4c902d2f6e281cffb74434c8457a6eb24b01 100644 (file)
@@ -8,6 +8,6 @@
 
 package main
 
-type A [...]int        // ERROR "outside of array literal"
+type A [...]int        // ERROR "outside of array literal|invalid use of \[\.\.\.\]"
 
 
index 3fc7fb2eeff7cf002d43bbfaedf4ed3d971baf3a..fea6829992f57ac699f7fe08f934dfec767b7a38 100644 (file)
@@ -9,14 +9,14 @@
 package main
 
 func f1() {
-       a, b := f()     // ERROR "assignment mismatch|does not match"
+       a, b := f()     // ERROR "assignment mismatch|does not match|cannot initialize"
        _ = a
        _ = b
 }
 
 func f2() {
        var a, b int
-       a, b = f()      // ERROR "assignment mismatch|does not match"
+       a, b = f()      // ERROR "assignment mismatch|does not match|cannot assign"
        _ = a
        _ = b
 }
index df3e2e435bb26051215cad9a85550f65d820f05a..97a2d963f04ac717aabea63de11108311eac2f4c 100644 (file)
@@ -48,25 +48,25 @@ func main() {
        check("t.M()", t.M())
        check("pt.M()", pt.M())
        check("ti.M()", ti.M())
-       check("pti.M()", pti.M()) // ERROR "pointer to interface, not interface"
+       check("pti.M()", pti.M()) // ERROR "pointer to interface, not interface|no field or method M"
        check("s.M()", s.M())
        check("ps.M()", ps.M())
 
        i = t
        check("i = t; i.M()", i.M())
-       check("i = t; pi.M()", pi.M()) // ERROR "pointer to interface, not interface"
+       check("i = t; pi.M()", pi.M()) // ERROR "pointer to interface, not interface|no field or method M"
 
        i = pt
        check("i = pt; i.M()", i.M())
-       check("i = pt; pi.M()", pi.M()) // ERROR "pointer to interface, not interface"
+       check("i = pt; pi.M()", pi.M()) // ERROR "pointer to interface, not interface|no field or method M"
 
        i = s
        check("i = s; i.M()", i.M())
-       check("i = s; pi.M()", pi.M()) // ERROR "pointer to interface, not interface"
+       check("i = s; pi.M()", pi.M()) // ERROR "pointer to interface, not interface|no field or method M"
 
        i = ps
        check("i = ps; i.M()", i.M())
-       check("i = ps; pi.M()", pi.M()) // ERROR "pointer to interface, not interface"
+       check("i = ps; pi.M()", pi.M()) // ERROR "pointer to interface, not interface|no field or method M"
 
        if !ok {
                println("BUG: interface10")
index 1fb3b6a05a2c4d91d6a7d027e5a3df635081e9ce..7aaaad4e485242f3b49fd3ca47de2b2081eb92db 100644 (file)
@@ -38,7 +38,7 @@ var e E
 
 func main() {
        e = t // ok
-       t = e // ERROR "need explicit|need type assertion"
+       t = e // ERROR "need explicit|need type assertion|incompatible type"
 
        // neither of these can work,
        // because i has an extra method
@@ -47,17 +47,17 @@ func main() {
        t = i // ERROR "incompatible|assignment$"
 
        i = i2 // ok
-       i2 = i // ERROR "incompatible|missing N method"
+       i2 = i // ERROR "incompatible|missing N method|cannot convert"
 
        i = I(i2)  // ok
-       i2 = I2(i) // ERROR "invalid|missing N method"
+       i2 = I2(i) // ERROR "invalid|missing N method|cannot convert"
 
        e = E(t) // ok
-       t = T(e) // ERROR "need explicit|need type assertion|incompatible"
+       t = T(e) // ERROR "need explicit|need type assertion|incompatible|cannot convert"
 
        // cannot type-assert non-interfaces
        f := 2.0
-       _ = f.(int) // ERROR "non-interface type"
+       _ = f.(int) // ERROR "non-interface type|not an interface type"
 
 }
 
@@ -83,8 +83,8 @@ var jj Int
 var m1 M = ii // ERROR "incompatible|missing"
 var m2 M = jj // ERROR "incompatible|wrong type for M method"
 
-var m3 = M(ii) // ERROR "invalid|missing"
-var m4 = M(jj) // ERROR "invalid|wrong type for M method"
+var m3 = M(ii) // ERROR "invalid|missing|cannot convert"
+var m4 = M(jj) // ERROR "invalid|wrong type for M method|cannot convert"
 
 type B1 interface {
        _() // ERROR "methods must have a unique non-blank name"
@@ -101,5 +101,9 @@ func (t *T2) M() {}
 func (t *T2) _() {}
 
 // Check that nothing satisfies an interface with blank methods.
-var b1 B1 = &T2{} // ERROR "incompatible|missing _ method"
-var b2 B2 = &T2{} // ERROR "incompatible|missing _ method"
+// Disabled this test as it's not clear we need this behavior.
+// See also issue #42964.
+/*
+var b1 B1 = &T2{} // "incompatible|missing _ method"
+var b2 B2 = &T2{} // "incompatible|missing _ method"
+*/
\ No newline at end of file
index 2927050669a9f58e710a577258d6ad28bc1a7bce..c21e4da390ab0fd92df3288c2d2d64fe994eb649 100644 (file)
@@ -32,7 +32,9 @@ func AddInst(Inst) *Inst {
 
 func main() {
        print("call addinst\n")
-       var x Inst = AddInst(new(Start)) // ERROR "pointer to interface"
+       var x Inst = AddInst(new(Start)) // ERROR "pointer to interface|incompatible type"
+       _ = x
        print("return from  addinst\n")
        var y *Inst = new(Start)  // ERROR "pointer to interface|incompatible type"
+       _ = y
 }
index 2b7ccdc1a7bdcad99d8a00834b154fee59187293..a0a87534a4a472e8643a9c6d0c8724f0e38fea09 100644 (file)
@@ -37,14 +37,14 @@ func main() {
        var sp SP
 
        v = t
-       p = t // ERROR "does not implement|requires a pointer"
+       p = t // ERROR "does not implement|requires a pointer|cannot use"
        _, _ = v, p
        v = &t
        p = &t
        _, _ = v, p
 
        v = s
-       p = s // ERROR "does not implement|requires a pointer"
+       p = s // ERROR "does not implement|requires a pointer|cannot use"
        _, _ = v, p
        v = &s
        p = &s
index 1eef6f1f35bd2001eea58274205120bc1662cd57..d354646552ba2bbca120a094d914b046bb2ac0c1 100644 (file)
@@ -813,6 +813,7 @@ func (t *test) run() {
                                "wb",
                                "append",
                                "slice",
+                               "typeassert",
                                "ssa/check_bce/debug",
                                "ssa/intrinsics/debug",
                                "ssa/prove/debug",