aboutsummaryrefslogtreecommitdiff
path: root/test/bugs
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2009-10-28 17:09:24 -0700
committerIan Lance Taylor <iant@golang.org>2009-10-28 17:09:24 -0700
commiteb63c3fec44a80df9ae3eaab4cc5c2dc101912bc (patch)
treeef1b80786f7d2aba72a3ec203c18de77591b8e9e /test/bugs
parentc54cb4cb4dc87726060ea8f7b677d918a3676231 (diff)
downloadgo-eb63c3fec44a80df9ae3eaab4cc5c2dc101912bc.tar.xz
Test that the compiler rejects map types which should not be
compatible. R=rsc CC=go-dev http://go/go-review/1018001
Diffstat (limited to 'test/bugs')
-rw-r--r--test/bugs/bug212.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/bugs/bug212.go b/test/bugs/bug212.go
new file mode 100644
index 0000000000..fcf5c4775f
--- /dev/null
+++ b/test/bugs/bug212.go
@@ -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"