Russ Cox | 933d712 | 2013-09-09 13:03:59 -0400 | [diff] [blame] | 1 | // errorcheck |
| 2 | |
| 3 | // Used to emit a spurious "invalid recursive type" error. |
| 4 | // See golang.org/issue/5581. |
| 5 | |
Emmanuel Odeke | 53fd522 | 2016-04-10 14:32:26 -0700 | [diff] [blame] | 6 | // Copyright 2013 The Go Authors. All rights reserved. |
Russ Cox | 933d712 | 2013-09-09 13:03:59 -0400 | [diff] [blame] | 7 | // Use of this source code is governed by a BSD-style |
| 8 | // license that can be found in the LICENSE file. |
| 9 | |
| 10 | package main |
| 11 | |
| 12 | import "fmt" |
| 13 | |
| 14 | func NewBar() *Bar { return nil } |
| 15 | |
| 16 | func (x *Foo) Method() (int, error) { |
| 17 | for y := range x.m { |
| 18 | _ = y.A |
| 19 | } |
| 20 | return 0, nil |
| 21 | } |
| 22 | |
| 23 | type Foo struct { |
| 24 | m map[*Bar]int |
| 25 | } |
| 26 | |
| 27 | type Bar struct { |
| 28 | A *Foo |
Ian Lance Taylor | 161a45a | 2013-12-12 17:18:12 -0800 | [diff] [blame] | 29 | B chan Blah // ERROR "undefined.*Blah" |
Russ Cox | 933d712 | 2013-09-09 13:03:59 -0400 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | func main() { |
| 33 | fmt.Println("Hello, playground") |
| 34 | } |