blob: a43e406676aa3a20f02256b5e38c48091092b656 [file] [log] [blame]
Rémy Oudompheng2ece2f52012-02-18 22:15:42 +01001// compile
David Symondsd5fa81e2009-04-20 21:03:38 -07002
3// Copyright 2009 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package main
8
9type myMap map[string] int;
10
Russ Cox4c5c0f42009-06-25 14:44:09 -070011func f() myMap {
David Symonds2f8a2dc2009-04-21 20:26:26 -070012 m := make(map[string] int);
Russ Cox4c5c0f42009-06-25 14:44:09 -070013 return m
David Symonds2f8a2dc2009-04-21 20:26:26 -070014}
15
David Symondsd5fa81e2009-04-20 21:03:38 -070016func main() {
17 m := make(myMap);
18 mp := &m;
19
20 {
Russ Coxae54cf72009-09-15 12:42:24 -070021 x, ok := m["key"];
22 _, _ = x, ok;
David Symondsd5fa81e2009-04-20 21:03:38 -070023 }
24 {
Russ Coxae54cf72009-09-15 12:42:24 -070025 x, ok := (*mp)["key"];
26 _, _ = x, ok;
David Symondsd5fa81e2009-04-20 21:03:38 -070027 }
28 {
Russ Coxae54cf72009-09-15 12:42:24 -070029 x, ok := f()["key"];
30 _, _ = x, ok;
David Symonds2f8a2dc2009-04-21 20:26:26 -070031 }
32 {
33 var x int;
34 var ok bool;
Russ Cox1a319892009-09-14 21:03:53 -070035 x, ok = f()["key"];
36 _, _ = x, ok;
David Symonds2f8a2dc2009-04-21 20:26:26 -070037 }
David Symondsd5fa81e2009-04-20 21:03:38 -070038}
39
40/*
41 * bug143.go:19: assignment count mismatch: 2 = 1
42 * bug143.go:18: x: undefined
43 * bug143.go:18: ok: undefined
44 */