]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: make enqueued map keys fail validation on forward types
authorTal Shprecher <tshprecher@gmail.com>
Mon, 11 Apr 2016 01:12:41 +0000 (18:12 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 13 Apr 2016 08:43:12 +0000 (08:43 +0000)
commit24967ec122710e73b35893925fd9a8390d7524ab
treee2cc2498bcd3549fdc63180a4131372ea222e0d2
parent0e01db4b8d6ac64e6661508bc6876fa41c799208
cmd/compile: make enqueued map keys fail validation on forward types

Map keys are currently validated in multiple locations but share
a common validation routine. The problem is that early validations
should be lenient enough to allow for forward types while the final
validations should not. The final validations should fail on forward
types since they've already settled.

This change also separates the key type checking from the creation
of the map via typMap. Instead of the mapqueue being populated in
copytype() by checking the map line number, it's populated in the
same block that validates the key type. This isolates key validation
logic while type checking.

Fixes #14988

Change-Id: Ia47cf6213585d6c63b3a35249104c0439feae658
Reviewed-on: https://go-review.googlesource.com/21830
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/type.go
src/cmd/compile/internal/gc/typecheck.go
test/fixedbugs/issue14988.go [new file with mode: 0644]