]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: new absdiff.go test, fix problem with g.curDecl
authorDan Scales <danscales@google.com>
Mon, 24 Jan 2022 22:38:01 +0000 (14:38 -0800)
committerDan Scales <danscales@google.com>
Tue, 25 Jan 2022 00:39:08 +0000 (00:39 +0000)
commit16d6a5233a183be7264295c66167d35c689f9372
tree3638275208a0dd154db18c223616a59fcae270e7
parent84eefdc933410907495e42aac872036403851ffa
cmd/compile: new absdiff.go test, fix problem with g.curDecl

Added a new absdiff2.go test case, which works fully without using a
typeparam on the right-hand-side of a type declaration (which is
disallowed). Fixed an issue that the test revealed, which is that we
need to set g.curDecl properly for the "later" functions which are
deferred until after all declarations are initially processed. Also,
g.curDecl may be non-nil in typeDecl for local type declaration. So, we
adjust the associate assertion, and save/restore g.curDecl
appropriately.

Fixes #50790

Change-Id: Ieed76a7ad0a83bccb99cbad4bf98a7bfafbcbbd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/380594
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
src/cmd/compile/internal/noder/decl.go
test/run.go
test/typeparam/absdiff2.go [new file with mode: 0644]
test/typeparam/absdiffimp2.dir/a.go [new file with mode: 0644]
test/typeparam/absdiffimp2.dir/main.go [new file with mode: 0644]
test/typeparam/absdiffimp2.go [new file with mode: 0644]