mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go/types: add test for interface method field type
Add a test that would have detected the regression in #74303: interface method fields should have a recorded type. For #74303 Change-Id: Ide5df51cd71c38809c364bb4f95950163ecefb66 Reviewed-on: https://go-review.googlesource.com/c/go/+/683595 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
6e618cd42a
commit
34cf5f6205
2 changed files with 10 additions and 0 deletions
|
|
@ -358,6 +358,11 @@ func TestTypesInfo(t *testing.T) {
|
|||
// go.dev/issue/47895
|
||||
{`package p; import "unsafe"; type S struct { f int }; var s S; var _ = unsafe.Offsetof(s.f)`, `s.f`, `int`},
|
||||
|
||||
// go.dev/issue/74303. Note that interface field types are synthetic, so
|
||||
// even though `func()` doesn't appear in the source, it appears in the
|
||||
// syntax tree.
|
||||
{`package p; type T interface { M(int) }`, `func(int)`, `func(int)`},
|
||||
|
||||
// go.dev/issue/50093
|
||||
{`package u0a; func _[_ interface{int}]() {}`, `int`, `int`},
|
||||
{`package u1a; func _[_ interface{~int}]() {}`, `~int`, `~int`},
|
||||
|
|
|
|||
|
|
@ -364,6 +364,11 @@ func TestTypesInfo(t *testing.T) {
|
|||
// go.dev/issue/47895
|
||||
{`package p; import "unsafe"; type S struct { f int }; var s S; var _ = unsafe.Offsetof(s.f)`, `s.f`, `int`},
|
||||
|
||||
// go.dev/issue/74303. Note that interface field types are synthetic, so
|
||||
// even though `func()` doesn't appear in the source, it appears in the
|
||||
// syntax tree.
|
||||
{`package p; type T interface { M(int) }`, `func(int)`, `func(int)`},
|
||||
|
||||
// go.dev/issue/50093
|
||||
{`package u0a; func _[_ interface{int}]() {}`, `int`, `int`},
|
||||
{`package u1a; func _[_ interface{~int}]() {}`, `~int`, `~int`},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue