diff options
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" |
