diff options
author | zhouguangyuan <zhouguangyuan.xian@gmail.com> | 2021-12-16 22:18:26 +0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-12-16 15:44:40 +0000 |
commit | 1d3a5b4aeac319acd51b32e1d47a9c316d9ce2aa (patch) | |
tree | 25313a37dbe99c61a0080b5b60d0b4af1eb09b5d /src/reflect/all_test.go | |
parent | 7f2314530e7cb4a11c6df4f7bd51187f5cffe2a5 (diff) | |
download | go-1d3a5b4aeac319acd51b32e1d47a9c316d9ce2aa.tar.gz go-1d3a5b4aeac319acd51b32e1d47a9c316d9ce2aa.zip |
reflect: fix name of type parameter
Fixes #50208
Change-Id: Ib0aff56341adb98ff6831c5badd1603ebf002b79
Reviewed-on: https://go-review.googlesource.com/c/go/+/372774
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/reflect/all_test.go')
-rw-r--r-- | src/reflect/all_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 9c8434c22c..866f38e687 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -7768,3 +7768,17 @@ func TestMethodCallValueCodePtr(t *testing.T) { t.Errorf("methodValueCall code pointer mismatched, want: %v, got: %v", want, got) } } + +type A struct{} +type B[T any] struct{} + +func TestIssue50208(t *testing.T) { + want1 := "B[reflect_test.A]" + if got := TypeOf(new(B[A])).Elem().Name(); got != want1 { + t.Errorf("name of type parameter mismatched, want:%s, got:%s", want1, got) + } + want2 := "B[reflect_test.B[reflect_test.A]]" + if got := TypeOf(new(B[B[A]])).Elem().Name(); got != want2 { + t.Errorf("name of type parameter mismatched, want:%s, got:%s", want2, got) + } +} |