diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2022-06-21 02:30:21 -0700 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2022-06-23 21:53:09 +0000 |
| commit | 61ae2b734cdbc0db342036a2a026fe1fccdccde3 (patch) | |
| tree | f84dc5dc6bc118472573f53d0ac276ec04320f8f /src/cmd/compile/internal/reflectdata | |
| parent | 3d432b6c4b86a5fcd1ccce0f914193b8e0e9e79e (diff) | |
| download | go-61ae2b734cdbc0db342036a2a026fe1fccdccde3.tar.xz | |
[dev.unified] cmd/compile: plumb rtype through OSWITCH/OCASE clauses
For (value) switch statements, we may generate OEQ comparisons between
values of interface and concrete type, which in turn may require
access to the concrete type's RType.
To plumb this through, this CL adds CaseClause.RTypes to hold the
rtype values, updates the GOEXPERIMENT=unified frontend to set it, and
updates walk to plumb rtypes through into generated OEQ nodes.
Change-Id: I6f1de2a1167ce54f5770147498a0a591efb3f012
Reviewed-on: https://go-review.googlesource.com/c/go/+/413361
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata')
| -rw-r--r-- | src/cmd/compile/internal/reflectdata/helpers.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/reflectdata/helpers.go b/src/cmd/compile/internal/reflectdata/helpers.go index 66f1864474..5edb495a81 100644 --- a/src/cmd/compile/internal/reflectdata/helpers.go +++ b/src/cmd/compile/internal/reflectdata/helpers.go @@ -84,9 +84,7 @@ func AppendElemRType(pos src.XPos, n *ir.CallExpr) ir.Node { func CompareRType(pos src.XPos, n *ir.BinaryExpr) ir.Node { assertOp2(n, ir.OEQ, ir.ONE) base.AssertfAt(n.X.Type().IsInterface() != n.Y.Type().IsInterface(), n.Pos(), "expect mixed interface and non-interface, have %L and %L", n.X, n.Y) - // TODO(mdempsky): Need to propagate RType from OSWITCH/OCASE - // clauses to emitted OEQ nodes. - if haveRType(n, n.RType, "RType", false) { + if haveRType(n, n.RType, "RType", true) { return n.RType } typ := n.X.Type() |
