aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2026-03-24 21:14:30 +0700
committerGopher Robot <gobot@golang.org>2026-03-26 08:54:42 -0700
commit286a79658efbe6dcbea53aaf8112abeb8e9f2cc3 (patch)
tree4c6a23b9c42f186e13a90c23df50020dcf28e930
parent09dadce4fee15148a9f3a6969d15a0db8afe75bc (diff)
downloadgo-286a79658efbe6dcbea53aaf8112abeb8e9f2cc3.tar.xz
cmd/compile: fix missing walk for OAS2RECV node
When channel receive operator is used in the context that requires conversion to destination type, there's an implicit conversion operator inserted by typecheck. This typecheck-ed node is un-walked, then passing to the backend as-is, causing the ICE. Fixes #78313 Change-Id: Ibbc70cbd2d8069cc7cf81934406aa68c4da2686a Reviewed-on: https://go-review.googlesource.com/c/go/+/758660 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r--src/cmd/compile/internal/walk/assign.go2
-rw-r--r--test/fixedbugs/issue78313.go9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/walk/assign.go b/src/cmd/compile/internal/walk/assign.go
index f640cd83d1..35eb72f0d0 100644
--- a/src/cmd/compile/internal/walk/assign.go
+++ b/src/cmd/compile/internal/walk/assign.go
@@ -220,7 +220,7 @@ func walkAssignRecv(init *ir.Nodes, n *ir.AssignListStmt) ir.Node {
fn := chanfn("chanrecv2", 2, r.X.Type())
ok := n.Lhs[1]
call := mkcall1(fn, types.Types[types.TBOOL], init, r.X, n1)
- return typecheck.Stmt(ir.NewAssignStmt(base.Pos, ok, call))
+ return walkAssign(init, typecheck.Stmt(ir.NewAssignStmt(base.Pos, ok, call)))
}
// walkReturn walks an ORETURN node.
diff --git a/test/fixedbugs/issue78313.go b/test/fixedbugs/issue78313.go
new file mode 100644
index 0000000000..19016711f3
--- /dev/null
+++ b/test/fixedbugs/issue78313.go
@@ -0,0 +1,9 @@
+// compile
+
+// Copyright 2026 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package p
+
+var a, _ any = <-(chan int)(nil)