diff options
author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-06-01 00:56:14 +0700 |
---|---|---|
committer | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-06-01 17:10:20 +0000 |
commit | 4b10e4c5473560539c6a6470e45391e8b9a9e786 (patch) | |
tree | 846f3eb4acde9812a2b35fc7b22318437a93f88c /test/typeparam/issue46472.go | |
parent | f32f4f58d9cd9d15371ee6198c1b222bcf2b56d9 (diff) | |
download | go-4b10e4c5473560539c6a6470e45391e8b9a9e786.tar.gz go-4b10e4c5473560539c6a6470e45391e8b9a9e786.zip |
[dev.typeparams] cmd/compile: handle ONONAME in subster.node
Fixes #46472
Change-Id: I27802978fa0c3bb32a29e452165a6fcac93473bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/323731
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'test/typeparam/issue46472.go')
-rw-r--r-- | test/typeparam/issue46472.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/typeparam/issue46472.go b/test/typeparam/issue46472.go new file mode 100644 index 0000000000..bab48e7d2f --- /dev/null +++ b/test/typeparam/issue46472.go @@ -0,0 +1,20 @@ +// run -gcflags=-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 main + +func foo[T any](d T) { + switch v := interface{}(d).(type) { + case string: + if v != "x" { + panic("unexpected v: "+v) + } + } + +} +func main() { + foo("x") +} |