]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix compile failure for lazily resolved shadowed types
authorMatthew Dempsky <mdempsky@google.com>
Thu, 21 Jun 2018 23:12:17 +0000 (16:12 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 22 Jun 2018 17:57:09 +0000 (17:57 +0000)
commitf422bea498b138022135060050bbbc249589a945
treee481dc22c1a098f22c76642054bb18f800bbca40
parent78a579316b84f68eaf8ee401e77fdb85bb13483f
cmd/compile: fix compile failure for lazily resolved shadowed types

If expanding an inline function body required lazily expanding a
package-scoped type whose identifier was shadowed within the function
body, the lazy expansion would instead overwrite the local symbol
definition instead of the package-scoped symbol. This was due to
importsym using s.Def instead of s.PkgDef.

Unfortunately, this is yet another consequence of the current awkward
scope handling code.

Passes toolstash-check.

Fixes #25984.

Change-Id: Ia7033e1749a883e6e979c854d4b12b0b28083dd8
Reviewed-on: https://go-review.googlesource.com/120456
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/export.go
src/cmd/compile/internal/types/scope.go
test/fixedbugs/issue25984.dir/p.go [new file with mode: 0644]
test/fixedbugs/issue25984.dir/q.go [new file with mode: 0644]
test/fixedbugs/issue25984.go [new file with mode: 0644]