]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: print struct tags in var decl in inlined func body
authorRuss Cox <rsc@golang.org>
Tue, 16 Feb 2016 17:09:05 +0000 (12:09 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 16 Feb 2016 19:39:10 +0000 (19:39 +0000)
commitfeb2a5d6103dad76b6374c5f346e33d55612cb2a
tree681d04fec2057ce4828efadbfe51d72f3e8ef538
parente136cac48c14aa85795625169379eeeddce35e4f
cmd/compile: print struct tags in var decl in inlined func body

This bug was introduced in golang.org/cl/18217,
while trying to fix #13777.

Originally I wanted to just disable inlining for the case
being handled incorrectly, but it's fairly difficult to detect
and much easier just to fix. Since the case being handled
incorrectly was inlined correctly in Go 1.5, not inlining it
would also be somewhat of a regression.
So just fix it.

Test case copied from Ian's CL 19520.

The mistake to worry about in this CL would be relaxing
the condition too much (we now print the note more often
than we did yesterday). To confirm that we'd catch this mistake,
I checked that changing (!fmtbody || !t.Funarg) to (true) does
cause fixedbugs/issue13777.go to fail. And putting it back
to what is written in this CL makes that test pass again
as well as the new fixedbugs/issue14331.go.
So I believe that the new condition is correct for both constraints.

Fixes #14331.

Change-Id: I91f75a4d5d07c53af5caea1855c780d9874b8df6
Reviewed-on: https://go-review.googlesource.com/19514
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/fmt.go
test/fixedbugs/issue14331.dir/a.go [new file with mode: 0644]
test/fixedbugs/issue14331.dir/b.go [new file with mode: 0644]
test/fixedbugs/issue14331.go [new file with mode: 0644]