diff options
author | korzhao <korzhao95@gmail.com> | 2021-09-06 21:08:05 +0800 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-09-07 03:56:13 +0000 |
commit | 6226020c2f713e4545c73d56dc05676b642c9bc7 (patch) | |
tree | 98336f9659c9dd9a088940dcefaedc5b777d5be3 /test/typeparam/issue48198.go | |
parent | a1938435d6361dcbc93a15ce0ace28748a45b85d (diff) | |
download | go-git-6226020c2f713e4545c73d56dc05676b642c9bc7.tar.gz |
cmd/compile: make sure that the names created for instantiated type are the same
Now we have two functions that create names for instantiated types.
They are inconsistent when dealing with byte/rune type.
This CL makes instTypeName2 reuse the code of typecheck.InstTypeName
Fixes #48198
Change-Id: I4c216b532cba6618ef9b63fd0b76e8f1c0ed7a75
Reviewed-on: https://go-review.googlesource.com/c/go/+/347491
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'test/typeparam/issue48198.go')
-rw-r--r-- | test/typeparam/issue48198.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/typeparam/issue48198.go b/test/typeparam/issue48198.go new file mode 100644 index 0000000000..1d7e44e0c4 --- /dev/null +++ b/test/typeparam/issue48198.go @@ -0,0 +1,22 @@ +// compile -G=3 + +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +package p + +type Foo[T any] struct { +} + +func (foo Foo[T]) Get() { +} + +var( + _ = Foo[byte]{} + _ = Foo[[]byte]{} + _ = Foo[map[byte]rune]{} + + _ = Foo[rune]{} + _ = Foo[[]rune]{} + _ = Foo[map[rune]byte]{} +) |