aboutsummaryrefslogtreecommitdiff
path: root/test/interface/explicit.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2020-12-01 17:37:12 -0800
committerRobert Griesemer <gri@golang.org>2020-12-03 17:55:56 +0000
commit7a1aa7dfaf9a7208a6cae7518037d885c9fabdbd (patch)
treeaa509df6b2972df2bb5e86af12d5c5d6a4989c67 /test/interface/explicit.go
parent07d32c8183eb4f7d8d1d6185ea69b8fb0425f6a6 (diff)
downloadgo-7a1aa7dfaf9a7208a6cae7518037d885c9fabdbd.tar.xz
[dev.typeparams] test: adjust more test cases to match compiler -G output
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>
Diffstat (limited to 'test/interface/explicit.go')
-rw-r--r--test/interface/explicit.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/test/interface/explicit.go b/test/interface/explicit.go
index 1fb3b6a05a..7aaaad4e48 100644
--- a/test/interface/explicit.go
+++ b/test/interface/explicit.go
@@ -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