]> Cypherpunks repositories - gostls13.git/commitdiff
We should not silently permit a named type to match an unnamed
authorIan Lance Taylor <iant@golang.org>
Mon, 2 Nov 2009 19:58:47 +0000 (11:58 -0800)
committerIan Lance Taylor <iant@golang.org>
Mon, 2 Nov 2009 19:58:47 +0000 (11:58 -0800)
type.  This is OK in a conversion but not in an assignment.

R=rsc
http://go/go-review/1016024

test/bugs/bug212.go

index fcf5c4775f224b7276bf9176e898ab398861eace..079bb5791f5d07af96a469e52df0441717054dbe 100644 (file)
@@ -7,6 +7,6 @@
 package main
 type I int 
 type S struct { f map[I]int }
-var v1 = S{ make(map[int]int) }                // OK--names are ignored.
-var v2 map[I]int = map[int]int{}       // OK.
+var v1 = S{ make(map[int]int) }                // ERROR "cannot|illegal|incompatible|wrong"
+var v2 map[I]int = map[int]int{}       // ERROR "cannot|illegal|incompatible|wrong"
 var v3 = S{ make(map[uint]int) }       // ERROR "cannot|illegal|incompatible|wrong"