From b7c4314ecb87ee18d6dd8bc12f75bc1716f5ce88 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 24 Nov 2009 16:11:48 -0800 Subject: [PATCH] gc: correct type check for x, ok map assignment Fixes #288. R=ken2 https://golang.org/cl/157162 --- src/cmd/gc/typecheck.c | 2 +- test/fixedbugs/bug220.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/fixedbugs/bug220.go diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c index fb96221bd6..0fd359b319 100644 --- a/src/cmd/gc/typecheck.c +++ b/src/cmd/gc/typecheck.c @@ -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 index 0000000000..3f8aaa4ece --- /dev/null +++ b/test/fixedbugs/bug220.go @@ -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; +} -- 2.50.0