Various bug fixes:
- don't allow := to redeclare non-variables
- don't permit a comma-ok expression as a two-value function return
Lots of dead code removed.
Fixesgolang/go#5500.
R=adonovan
CC=golang-dev
https://golang.org/cl/10792044
We use the new field to determine whether or not a function is
synthetic, not Pos() == 0, so synthetic functions can have
positions too.
R=gri
CC=golang-dev
https://golang.org/cl/10916044
Instead of passing around iota everywhere, keep track of the
current value in the checker, and update it when entering
different declarations. This is less explicit, but the improvement
over all code is so significant that it is worth it.
R=adonovan
CC=golang-dev
https://golang.org/cl/10814044
- moved ident and typ expr checking into typexpr.go
- as a result, fewer parameters are needed for expr checking
- forward-chain type decls of the form type ( A B; B C; C *A) etc.
so that cycles are getting the right types in all cases
- fixed several corner case bugs, added more test cases
R=adonovan
CC=golang-dev
https://golang.org/cl/10773043
Fixed one aspect of issue 5090. Fixing it completely
requires a bit more work around the representation of
interface types.
R=adonovan
CC=golang-dev
https://golang.org/cl/10678045
Removed special case for testdata/test.go file in favor of
a simpler, more flexible, and explicit flag for one-off test
packages.
R=adonovan
CC=golang-dev
https://golang.org/cl/10618044
Before, all values received on some channel by Select would
flow to an empty interface, creating a spurious confluence for
flow analyses. Now, the tuple returned by Select has one
component for each 'receive' case.
Also, fixes:
- Removed workarounds for now-fixed typechecker bug in FuncLit+TypeAssert.
- sanity check that all Value Instructions have non-nil Type().
- Convert: document and sanity-check that at least one of the types is basic.
Also, other things to help clients:
- Define CallInstruction interface: common parts of Call, Go, Defer.
- Add CallCommon.Signature() method.
- Literal.Pos() is now populated.
R=gri
CC=golang-dev
https://golang.org/cl/10505043
Need the ./ for the path. Quick fix to get the build green, but what really is the right answer for Windows?
R=golang-dev
CC=golang-dev
https://golang.org/cl/10359044
Test the statistics work as expected for a simple program, which can be extended as needed. This is all a bit meta.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10392050
Experimental feature. It's too noisy yet to be enabled by default,
so it must be enabled explicitly by
go tool vet -shadow *.go
or
go tool vet -shadow directory
(The go command does not know about the -shadow flag.)
Fixesgolang/go#5634.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/10409047
- LookupFieldOrMethod now computes if any indirection was found on the
way to an embedded field/method: this is the only information required
to determine if a result method is in the method set.
- Scopes now provide a link to the ast.Node responsible for them.
Also:
- don't permit unsafe.Offsetof on method values
- report ambiguities in field/method lookup errors
- added some missing checks for anonymous fields
- lots of new tests
Fixesgolang/go#5499.
R=adonovan
CC=golang-dev
https://golang.org/cl/10411045
- much simpler lookup
- more result information
- will make tracking of pointer-ness easier
TODO: apply the same changes to method set computation
R=adonovan
CC=golang-dev
https://golang.org/cl/10379049
- moved single field and method lookup functionality
from operand.go to new file lookup.go and cleaned
up the lookup implementation
- implemented method set computation using the same
basic structure as for field/method lookup, in new
file methodset.go
- minor related changes
- the method set computation ignores pointer-ness of
the receiver type at the moment (next CL)
- fixed a couple of bugs (missing pkg info for imported
embedded types, wrong test for method expressions)
The method set computation is currently verified by
comparing a regular method lookup with a method-set
based method lookup.
R=adonovan
CC=golang-dev
https://golang.org/cl/10235049
Before:
math/big/nat_test.go:688: arg r for printf verb %s of wrong type: ..Word
After:
math/big/nat_test.go:688: arg r for printf verb %s of wrong type: big.Word
R=gri
CC=golang-dev
https://golang.org/cl/10400044
A trailing % resulted in a bad error message.
Also clean up a couple of dregs left over from the
refactoring to add indexed formats.
R=dsymonds
CC=golang-dev
https://golang.org/cl/10336044
methodIndex() utility was split and specialized to its two
cases, *Interface vs *Named, which are logically quite
different.
We can't memoize promotion wrappers yet; we need typemap.
Terminology:
- "thunks" are now "wrappers"
- "bridge methods" are now "promotion wrappers"
Where the diff is messy it's just because of indentation.
R=gri
CC=golang-dev
https://golang.org/cl/10282043