]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] cmd/compile: fix expression switches using type parameters
authorKeith Randall <khr@golang.org>
Thu, 10 Mar 2022 18:01:35 +0000 (10:01 -0800)
committerDmitri Shuralyov <dmitshur@golang.org>
Mon, 14 Mar 2022 16:21:37 +0000 (16:21 +0000)
commit2c6a889234651e96d64479a0581b22944fdab611
treeb55251f0adccb487419fc60b8397c0e78c9933f8
parent1edc1ccf1519afe8d2fd5cb1e488d11e7702dee2
[release-branch.go1.18] cmd/compile: fix expression switches using type parameters

Both the thing we're switching on, as well as the cases we're switching for.
Convert anything containing a type parameter to interface{} before the
comparison happens.

Fixes #51522

Change-Id: I97ba9429ed332cb7d4240cb60f46d42226dcfa5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/391594
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
(cherry picked from commit 2e46a0a99768408c90cf4eeda3690831693fd8b2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/391795
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ir/stmt.go
src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue51522b.go [new file with mode: 0644]