aboutsummaryrefslogtreecommitdiff
path: root/test/typeparam
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-10-18 18:11:48 -0700
committerDan Scales <danscales@google.com>2021-10-26 20:08:41 +0000
commitb54bdd281e62a4658ea4edb5e0a6139006938c9a (patch)
tree6df6aac4c21491e7a3cf036b6d314a24ab38acf5 /test/typeparam
parent1dc77a38d293763b9de50110dd72edd755ce72b7 (diff)
downloadgo-b54bdd281e62a4658ea4edb5e0a6139006938c9a.tar.xz
cmd/compile: clean up the switch statements in (*genInst).node()
There were two main outer switch statements in node() that can just be combined. Also, for simplicity, changed an IsCmp() conditional into just another case in the switch statement. Also, the inner OCALL switch statement had a bunch of fairly duplicate cases. Combined the cases that all had no special semantics, into a single default case calling transformCall(). In the OCALL case in dictPass(), got rid of a check for OFUNCINST (which will always have been removed by this point). Also, eliminated an assert that could cause unneded failures. transformCall() should always be called if the node op is still OCALL, so no need to assert on the ops of call.X. Added an extra test in issue47078.go, to explicitly check for case where the X argument of a call is a DOTTYPE. Change-Id: Ifb3f812ce12820a4ce08afe2887f00f7fc00cd2f Reviewed-on: https://go-review.googlesource.com/c/go/+/358596 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/typeparam')
-rw-r--r--test/typeparam/issue47878.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/typeparam/issue47878.go b/test/typeparam/issue47878.go
index cb1043a440..6ad183d221 100644
--- a/test/typeparam/issue47878.go
+++ b/test/typeparam/issue47878.go
@@ -31,6 +31,13 @@ func (s Src4[T]) Next() {
_ = (<-s)()
}
+type Src5[T any] func() Src5[T]
+
+func (s Src5[T]) Next() {
+ var x interface{} = s
+ _ = (x.(Src5[T]))()
+}
+
func main() {
var src1 Src1[int]
src1.Next()
@@ -43,4 +50,7 @@ func main() {
var src4 Src4[int]
src4.Next()
+
+ var src5 Src5[int]
+ src5.Next()
}