]> Cypherpunks repositories - gostls13.git/commit
go/types: fix type-checking of shift expressions
authorRobert Griesemer <gri@golang.org>
Thu, 28 Feb 2013 23:27:52 +0000 (15:27 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 28 Feb 2013 23:27:52 +0000 (15:27 -0800)
commit3a9fcc45f6938e2198d748a78f7c8b9c26692fad
tree881ac7243a634d30ad30c44e972d465b4e470177
parent38d4d3c66a2aaaa7e4a73d197bbe425116b8ef49
go/types: fix type-checking of shift expressions

Completely rethought shift expression type checking.
Instead of attempting to type-check them eagerly, now
delay the checking of untyped constant lhs in non-
constant shifts until the final expression type
becomes clear. Once it is clear, update the respective
expression tree with the final (not untyped) type and
check respective shift lhs' where necessary.

This also cleans up another conundrum: How to report
the type of untyped constants as it changes from
untyped to typed. Now, Context.Expr is only called
for an expresion x once x has received its final
(not untyped) type (for constant initializers, the
final type may still be untyped).

With this CL all remaining std lib packages that
did not typecheck due to shift errors pass now.

TODO: There's a lot of residual stuff that needs
to be cleaned up but with this CL all tests pass
now.

R=adonovan, axwalk
CC=golang-dev
https://golang.org/cl/7381052
src/pkg/exp/gotype/gotype_test.go
src/pkg/go/types/api.go
src/pkg/go/types/builtins.go
src/pkg/go/types/check.go
src/pkg/go/types/expr.go
src/pkg/go/types/stmt.go
src/pkg/go/types/testdata/expr3.src
src/pkg/go/types/testdata/stmt0.src