aboutsummaryrefslogtreecommitdiff
path: root/test/interface
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-06-09 11:00:55 -0700
committerRuss Cox <rsc@golang.org>2010-06-09 11:00:55 -0700
commita2a7d473f464d99b96366404a468d50131d61b9a (patch)
tree7e88feb433e89c7c55564cbceeb37d60baf6b37e /test/interface
parent42a691b8778becb7d2ee78ac171e26e03dbbf30a (diff)
downloadgo-a2a7d473f464d99b96366404a468d50131d61b9a.tar.gz
go-a2a7d473f464d99b96366404a468d50131d61b9a.zip
gc: more cleanup
* disallow surrogate pair runes. * diagnose impossible type assertions * eliminate another static buffer. * do not overflow lexbuf. * add -u flag to disable package unsafe. R=ken2 CC=golang-dev https://golang.org/cl/1619042
Diffstat (limited to 'test/interface')
-rw-r--r--test/interface/explicit.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/interface/explicit.go b/test/interface/explicit.go
index 797cec80e4..120135cb68 100644
--- a/test/interface/explicit.go
+++ b/test/interface/explicit.go
@@ -1,4 +1,4 @@
-// errchk $G $D/$F.go
+// errchk $G -e $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -50,3 +50,22 @@ func main() {
e = E(t) // ok
t = T(e) // ERROR "need explicit|need type assertion|incompatible"
}
+
+type M interface { M() }
+var m M
+
+var _ = m.(int) // ERROR "impossible type assertion"
+
+type Int int
+func (Int) M(float) {}
+
+var _ = m.(Int) // ERROR "impossible type assertion"
+
+var ii int
+var jj Int
+
+var m1 M = ii // ERROR "missing"
+var m2 M = jj // ERROR "wrong type for M method"
+
+var m3 = M(ii) // ERROR "missing"
+var m4 = M(jj) // ERROR "wrong type for M method"