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