]> Cypherpunks repositories - gostls13.git/commitdiff
test/interface/receiver.go: expand to do dynamic
authorRuss Cox <rsc@golang.org>
Sun, 15 Nov 2009 03:28:13 +0000 (19:28 -0800)
committerRuss Cox <rsc@golang.org>
Sun, 15 Nov 2009 03:28:13 +0000 (19:28 -0800)
versions of static checks in receiver1.go

R=r
https://golang.org/cl/155045

test/interface/receiver.go

index 438fea015508741dec092877a691197a91ebca66..87c26937f3a47bbf2059fe0e09feaabc98f35523 100644 (file)
@@ -58,6 +58,10 @@ func main() {
        v.V();
 
 //     p = t;  // ERROR
+       var i interface{} = t;
+       if _, ok := i.(P); ok {
+               panicln("dynamic i.(P) succeeded incorrectly");
+       }
 
 //     println("--struct--");
        var s S;
@@ -76,6 +80,10 @@ func main() {
        v.V();
 
 //     p = s;  // ERROR
+       var j interface{} = s;
+       if _, ok := j.(P); ok {
+               panicln("dynamic j.(P) succeeded incorrectly");
+       }
 
 //     println("--struct pointer--");
        var sp SP;