aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/inline
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-04-24 02:12:55 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-04-26 21:27:41 +0000
commit9f601690da59e601ff68f9868d5eb863bd770eae (patch)
tree2f67e35635247aae34a3bc90d8771f7efcdd688e /src/cmd/compile/internal/inline
parenta53dc4c1ce0e21da328bd5984900448bab354ba1 (diff)
downloadgo-9f601690da59e601ff68f9868d5eb863bd770eae.tar.gz
go-9f601690da59e601ff68f9868d5eb863bd770eae.zip
cmd/compile: workaround inlining of closures with type switches
Within clovar, n.Defn can also be *ir.TypeSwitchGuard. The proper fix here would be to populate m.Defn and have it filled in too, but we already leave it nil in inlvar. So for consistency, this CL does the same in clovar too. Eventually inl.go should be rewritten to fully respect IR invariants. Fixes #45743. Change-Id: I8b38e5d8b2329ad242de97670f2141f713954d28 Reviewed-on: https://go-review.googlesource.com/c/go/+/313289 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Trust: Dan Scales <danscales@google.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r--src/cmd/compile/internal/inline/inl.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index 54fcb2b830..339ea77509 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -1194,6 +1194,8 @@ func (subst *inlsubst) clovar(n *ir.Name) *ir.Name {
case *ir.AssignStmt, *ir.AssignListStmt:
// Mark node for reassignment at the end of inlsubst.node.
m.Defn = &subst.defnMarker
+ case *ir.TypeSwitchGuard:
+ // TODO(mdempsky): Set m.Defn properly. See discussion on #45743.
default:
base.FatalfAt(n.Pos(), "unexpected Defn: %+v", defn)
}