Source file src/internal/types/testdata/fixedbugs/issue6814.go
1 // Copyright 2026 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package p 6 7 type E struct { 8 e int 9 } 10 11 func (E) m() {} 12 13 type S struct { 14 E 15 x int 16 } 17 18 func (S) n() {} 19 20 func _() { 21 _ = S.X // ERROR "S.X undefined (type S has no field or method X, but does have field x)" 22 _ = S /* ERROR "operand for field selector E must be value of type S" */ .E 23 _ = S /* ERROR "operand for field selector x must be value of type S" */ .x 24 _ = S /* ERROR "operand for field selector e must be value of type S" */ .e 25 _ = S.m 26 _ = S.n 27 28 var s S 29 _ = s.X // ERROR "s.X undefined (type S has no field or method X, but does have field x)" 30 _ = s.E 31 _ = s.x 32 _ = s.e 33 _ = s.m 34 _ = s.n 35 } 36