]> Cypherpunks repositories - gostls13.git/commitdiff
gc: correct type check for x, ok map assignment
authorRuss Cox <rsc@golang.org>
Wed, 25 Nov 2009 00:11:48 +0000 (16:11 -0800)
committerRuss Cox <rsc@golang.org>
Wed, 25 Nov 2009 00:11:48 +0000 (16:11 -0800)
Fixes #288.

R=ken2
https://golang.org/cl/157162

src/cmd/gc/typecheck.c
test/fixedbugs/bug220.go [new file with mode: 0644]

index fb96221bd65e15bf7c0de20f1a4b73a780f5e4c8..0fd359b31980e38f28cbf31351e16bcdea1b820d 100644 (file)
@@ -2018,7 +2018,7 @@ typecheckas2(Node *n)
                if(l->type == T)
                        goto out;
                n->op = OAS2MAPW;
-               n->rlist->n = typecheckconv(nil, r, l->type->down, 0, nil);
+               n->rlist->n = typecheckconv(nil, r, l->type, 0, nil);
                r = n->rlist->next->n;
                n->rlist->next->n = typecheckconv(nil, r, types[TBOOL], 0, nil);
                goto out;
diff --git a/test/fixedbugs/bug220.go b/test/fixedbugs/bug220.go
new file mode 100644 (file)
index 0000000..3f8aaa4
--- /dev/null
@@ -0,0 +1,14 @@
+// $G $D/$F.go || echo BUG: bug220
+
+// 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
+
+func main() {
+       m := make(map[int]map[uint]float);
+       
+       m[0] = make(map[uint]float), false;     // 6g used to reject this
+       m[1] = nil;
+}