]> Cypherpunks repositories - gostls13.git/commitdiff
Test that the compiler rejects map types which should not be
authorIan Lance Taylor <iant@golang.org>
Thu, 29 Oct 2009 00:09:24 +0000 (17:09 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 29 Oct 2009 00:09:24 +0000 (17:09 -0700)
compatible.

R=rsc
CC=go-dev
http://go/go-review/1018001

test/bugs/bug212.go [new file with mode: 0644]
test/golden.out

diff --git a/test/bugs/bug212.go b/test/bugs/bug212.go
new file mode 100644 (file)
index 0000000..fcf5c47
--- /dev/null
@@ -0,0 +1,12 @@
+// errchk $G $D/$F.go
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+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 v3 = S{ make(map[uint]int) }       // ERROR "cannot|illegal|incompatible|wrong"
index c87d7e519e93cfd4cdb87804c8bfa83d29f710d7..4d915e280dceab9ab3c835fa0178533fa724701f 100644 (file)
@@ -201,3 +201,6 @@ throw: interface conversion
 panic PC=xxx
 
 == bugs/
+
+=========== bugs/bug212.go
+BUG: errchk: command succeeded unexpectedly