diff options
| author | Russ Cox <rsc@golang.org> | 2010-06-09 11:00:55 -0700 | 
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2010-06-09 11:00:55 -0700 | 
| commit | f067c34934cac10bb85820bc236efcf416176daa (patch) | |
| tree | d99738fe4769bf42cf63cc85900866a1c2eb5e4a /test/interface/explicit.go | |
| parent | cc5336b66c854904f622f322aba5f522c6e04f3c (diff) | |
| download | golang-f067c34934cac10bb85820bc236efcf416176daa.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/explicit.go')
| -rw-r--r-- | test/interface/explicit.go | 21 | 
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" | 
