| 
									
										
										
										
											2009-04-20 21:03:38 -07: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-04-21 20:26:26 -07:00
										 |  |  | func f() *myMap { | 
					
						
							|  |  |  | 	m := make(map[string] int); | 
					
						
							|  |  |  | 	return &m | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-20 21:03:38 -07:00
										 |  |  | func main() { | 
					
						
							|  |  |  | 	m := make(myMap); | 
					
						
							|  |  |  | 	mp := &m; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-04-21 20:26:26 -07:00
										 |  |  | 		x, ok := m["key"] | 
					
						
							| 
									
										
										
										
											2009-04-20 21:03:38 -07:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		x, ok := (*mp)["key"] | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		x, ok := mp["key"] | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-04-21 20:26:26 -07:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		x, ok := f()["key"] | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		var x int; | 
					
						
							|  |  |  | 		var ok bool; | 
					
						
							|  |  |  | 		x, ok = f()["key"] | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-04-20 21:03:38 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  |  * bug143.go:19: assignment count mismatch: 2 = 1 | 
					
						
							|  |  |  |  * bug143.go:18: x: undefined | 
					
						
							|  |  |  |  * bug143.go:18: ok: undefined | 
					
						
							|  |  |  |  */ |