aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorMark Freeman <mark@golang.org>2025-11-19 15:10:24 -0500
committerGopher Robot <gobot@golang.org>2025-11-19 13:38:11 -0800
commit4fef9f8b5596d42a2997fd8b74185d53fb7d0e43 (patch)
tree6f16ab898406a0539f5cccaa5dd7a28f9ad0878c /src/cmd
parent33529db142dab098d4687f99e27e6284c31fa039 (diff)
downloadgo-4fef9f8b5596d42a2997fd8b74185d53fb7d0e43.tar.xz
go/types, types2: fix object path for grouped declaration statements
CL 715840 deferred popping from the object path during handling of grouped declaration statements, which leaves extra objects on the path since this executes in a loop. Surprisingly, no test exercised this. This change fixes this small bug and adds a supporting test. Fixes #76366 Change-Id: I7fc038b39d3871eea3e60855c46614b463bcfa4f Reviewed-on: https://go-review.googlesource.com/c/go/+/722060 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/types2/decl.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/decl.go b/src/cmd/compile/internal/types2/decl.go
index 2df34f3b94..60371651ab 100644
--- a/src/cmd/compile/internal/types2/decl.go
+++ b/src/cmd/compile/internal/types2/decl.go
@@ -876,8 +876,8 @@ func (check *Checker) declStmt(list []syntax.Decl) {
scopePos := s.Name.Pos()
check.declare(check.scope, s.Name, obj, scopePos)
check.push(obj) // mark as grey
- defer check.pop()
check.typeDecl(obj, s, nil)
+ check.pop()
default:
check.errorf(s, InvalidSyntaxTree, "unknown syntax.Decl node %T", s)