2012-02-18 21:15:42 +00:00
|
|
|
// compile
|
2009-04-21 04:03:38 +00:00
|
|
|
|
|
|
|
// 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 myMap map[string] int;
|
|
|
|
|
2009-06-25 21:44:09 +00:00
|
|
|
func f() myMap {
|
2009-04-22 03:26:26 +00:00
|
|
|
m := make(map[string] int);
|
2009-06-25 21:44:09 +00:00
|
|
|
return m
|
2009-04-22 03:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-04-21 04:03:38 +00:00
|
|
|
func main() {
|
|
|
|
m := make(myMap);
|
|
|
|
mp := &m;
|
|
|
|
|
|
|
|
{
|
2009-09-15 19:42:24 +00:00
|
|
|
x, ok := m["key"];
|
|
|
|
_, _ = x, ok;
|
2009-04-21 04:03:38 +00:00
|
|
|
}
|
|
|
|
{
|
2009-09-15 19:42:24 +00:00
|
|
|
x, ok := (*mp)["key"];
|
|
|
|
_, _ = x, ok;
|
2009-04-21 04:03:38 +00:00
|
|
|
}
|
2009-04-22 03:26:26 +00:00
|
|
|
{
|
2009-09-15 19:42:24 +00:00
|
|
|
x, ok := f()["key"];
|
|
|
|
_, _ = x, ok;
|
2009-04-22 03:26:26 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
var x int;
|
|
|
|
var ok bool;
|
2009-09-15 04:03:53 +00:00
|
|
|
x, ok = f()["key"];
|
|
|
|
_, _ = x, ok;
|
2009-04-22 03:26:26 +00:00
|
|
|
}
|
2009-04-21 04:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* bug143.go:19: assignment count mismatch: 2 = 1
|
|
|
|
* bug143.go:18: x: undefined
|
|
|
|
* bug143.go:18: ok: undefined
|
|
|
|
*/
|