]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix expression switches using type parameters
authorKeith Randall <khr@golang.org>
Thu, 10 Mar 2022 18:01:35 +0000 (10:01 -0800)
committerKeith Randall <khr@golang.org>
Thu, 10 Mar 2022 19:30:33 +0000 (19:30 +0000)
commit2e46a0a99768408c90cf4eeda3690831693fd8b2
treece8eb61222c50e5b7bf4a2cb3bf8c6286e17972c
parent8cf11694abbfbdbd4fe0b2c08511f81b8bfe5017
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>
src/cmd/compile/internal/ir/stmt.go
src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue51522b.go [new file with mode: 0644]