summaryrefslogtreecommitdiff
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
commit590369866a6d10e4ed036dcb256cbac90faefff7 (patch)
treed99738fe4769bf42cf63cc85900866a1c2eb5e4a /test/interface
parentf6317a21e5176b721f035a9cb548771ef79abd34 (diff)
downloadgo-590369866a6d10e4ed036dcb256cbac90faefff7.tar.gz
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 http://codereview.appspot.com/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 797cec80e..120135cb6 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"