Cuong Manh Le | 0471417 | 2019-09-29 23:42:42 +0700 | [diff] [blame] | 1 | // errorcheck |
| 2 | |
| 3 | // Copyright 2019 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 | |
| 7 | // selector expression resolves incorrectly for defined |
| 8 | // pointer types. |
| 9 | |
| 10 | package main |
| 11 | |
| 12 | type E struct{ f int } |
| 13 | type T struct{ E } |
| 14 | |
| 15 | func (*T) f() int { return 0 } |
| 16 | |
| 17 | type P *T |
| 18 | type PP **T |
| 19 | |
| 20 | func main() { |
| 21 | var x P |
| 22 | _ = x.f // ERROR "x\.f undefined \(type P has no field or method f\)" |
| 23 | |
| 24 | var y PP |
| 25 | _ = y.f // ERROR "y\.f undefined \(type PP has no field or method f\)" |
| 26 | } |