diff options
author | Matthew Dempsky <mdempsky@google.com> | 2022-06-17 15:19:59 -0700 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-06-17 22:44:22 +0000 |
commit | ec58e3f3271de385cf976a805e611d3da09c3a0e (patch) | |
tree | 67ec2b626b1014645493cac124a8e81f46744fc3 /test/typeparam | |
parent | 103cc661f1906837d02133e9c65d0475ac49799c (diff) | |
download | go-ec58e3f3271de385cf976a805e611d3da09c3a0e.tar.gz go-ec58e3f3271de385cf976a805e611d3da09c3a0e.zip |
test: add regress test for #53419
This currently works with GOEXPERIMENT=unified. Add a regress test to
make sure it stays that way.
Updates #53419.
Change-Id: I2ea1f9039c59807fbd497d69a0420771f8d6d035
Reviewed-on: https://go-review.googlesource.com/c/go/+/413014
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test/typeparam')
-rw-r--r-- | test/typeparam/issue53419.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/typeparam/issue53419.go b/test/typeparam/issue53419.go new file mode 100644 index 0000000000..62a226ff9f --- /dev/null +++ b/test/typeparam/issue53419.go @@ -0,0 +1,28 @@ +// run + +// Copyright 2022 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 main + +type T1 struct{} +type T2 struct{} +type Both struct { + T1 + T2 +} + +func (T1) m() { panic("FAIL") } +func (T2) m() { panic("FAIL") } +func (Both) m() {} + +func f[T interface{ m() }](c T) { + c.m() +} + +func main() { + var b Both + b.m() + f(b) +} |