stdlib_test runs the builder (in sanity-checking mode) over
the Go standard library. It also prints some stats about
the time and memory usage.
Also:
- importer.LoadPackage too (not just doImport) must consult
the cache to avoid creating duplicate Package instances for
the same import path when called serially from a test.
- importer: skip empty directories without an error.
- importer: print all errors, not just the first.
- visit.go: added AllFunctions utility for enumerating all
Functions in a Program.
- ssa.MethodSet is not safe to expose from the package since
it must be accessed under an (inaccessible) lock. (!!!)
This CL makes it unexported and restricts its use to the
single function Program.LookupMethod().
- Program.MethodSet() has gone.
Clients should instead iterate over the types.MethodSet
and call LookupMethod.
- Package.DumpTo(): improved efficiency of methodset printing
(by not creating wrappers) and accuracy (by showing * on
receiver type only when necessary).
- Program.CreatePackage: documented precondition and added
assertion.
R=gri
CC=golang-dev
https://golang.org/cl/12058048
Also move some common code from main.go to handlers.go, and
exclude remotesearch.go from the appengine build (it is only
relevant to the command line interface).
R=bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/12001049
The analysis for types.Array was just missing. It's the same as a slice,
but we can't share code easily because the types differ, so we just dup it.
R=dsymonds
CC=golang-dev
https://golang.org/cl/12041045
First, %v and %T accept any arguments, so they should never warn.
Second, pointer types were not handled in matchArgType.
Third, the default response for matchArgType should be false.
R=r
CC=adonovan, golang-dev
https://golang.org/cl/12038050
Also:
- Implement Program.FuncValue for interface methods (+ test).
- go/types.Object.String(): don't package-qualify names unless
they are package level objects---otherwise you see "main.x" for
locals, struct fields, etc.
- go/types.Func.String(): don't assume Type() is *Signature;
it could be *Builtin.
R=gri
CC=golang-dev
https://golang.org/cl/12058045
buildDecl was visiting all decls in source order, but the spec
calls for visiting all vars and init() funcs in order, then
all remaining functions. These two passes are now called
buildInit(), buildFuncDecl().
+ Test.
Also:
- Added workaround to gcimporter for Func with pkg==nil.
- Prog.concreteMethods has been merged into Pkg.values.
- Prog.concreteMethod() renamed declaredFunc().
- s/mfunc/obj/ (name cleanup from recent gri CL)
R=gri
CC=golang-dev
https://golang.org/cl/12030044
A Method corresponds to a MethodVal Selection;
so the explicit Method object is not needed anymore.
- moved Selection code into separate file
- implemented Selection.String()
- improved and more consistent documentation
R=adonovan
CC=golang-dev
https://golang.org/cl/11950043
methprom.go covers method promotion.
Found bug: receiver() requires a following load under some
circumstances.
ifaceconv.go covers interface conversion.
Found bug: confusion about infallible and fallible conversions
led to use of TypeAssert in emitConv, which should never fail.
Changed semantics of ChangeInterface to make it infallible
and made some simplifications.
Also in this CL:
- SelectState.Pos now records the position of the
the '<-' operator for sends/receives done by a Select.
R=gri
CC=golang-dev
https://golang.org/cl/11931044
Should make it easier for clients to deal with
selector expressions.
Removed Field type: The respective information
is now reported in Info.Selections.
R=adonovan
CC=golang-dev
https://golang.org/cl/11942043
We now use LookupFieldOrMethod for all SelectorExprs, and
simplify the logic to discriminate the various cases.
We inline static calls to promoted/indirected functions,
dramatically reducing the number of functions created.
More tests are needed, but I'd like to submit this as-is.
In this CL, we:
- rely less on Id strings. Internally we now use
*types.Method (and its components) almost everywhere.
- stop thinking of types.Methods as objects. They don't
have stable identities. (Hopefully they will become
plain-old structs soon.)
- eliminate receiver indirection wrappers:
indirection and promotion are handled together by makeWrapper.
- Handle the interactions of promotion, indirection and
abstract methods much more cleanly.
- support receiver-bound interface method closures.
- break up builder.selectField so we can re-use parts
(emitFieldSelection).
- add importer.PackageInfo.classifySelector utility.
- delete interfaceMethodIndex()
- delete namedTypeMethodIndex()
- delete isSuperInterface() (replaced by types.IsAssignable)
- call memberFromObject on each declared concrete method's
*types.Func, not on every Method frem each method set, in the
CREATE phase for packages loaded by gcimporter.
go/types:
- document Func, Signature.Recv() better.
- use fmt in {Package,Label}.String
- reimplement Func.String to be prettier and to include method
receivers.
API changes:
- Function.method now holds the types.Method (soon to be
not-an-object) for synthetic wrappers.
- CallCommon.Method now contains an abstract (interface)
method object; was an abstract method index.
- CallCommon.MethodId() gone.
- Program.LookupMethod now takes a *Method not an Id string.
R=gri
CC=golang-dev
https://golang.org/cl/11674043
Also: Fixes a couple of places where scopes instead
of objsets were used (missed in previous CL).
R=adonovan
CC=golang-dev
https://golang.org/cl/11419047
Now, in a "switch y := x.(type)", there is no object for the
outer y, only implicit objects, one per case (including
default).
Also: don't set obj=nil for blank idents (workaround suggested by gri).
R=gri
CC=golang-dev
https://golang.org/cl/11564046
Fixes go tool vet breakage when applied to files
with incomplete type information for anonymous
fields.
R=adonovan
CC=golang-dev
https://golang.org/cl/11773043
After this change is submitted the dependants on go.talks/pkg/playground
talks will be updated to use this one and the old package will be deleted.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11759043
- implemented objset for tracking duplicates of fields and methods
which permitted a simpler and faster scope implementation in turn
- related cleanups and internal renames
- fixed a couple of identifier reporting bugs
Speed of type-checking itself increased by almost 10%
(from ~71Kloc/s to ~78Kloc/s on one machine, measured
via go test -run=Self).
R=adonovan
CC=golang-dev
https://golang.org/cl/11750043
- more consistent naming of some internal data types and methods
- better factoring of some error reporting code
- cleanup around association of methods with receiver base types
- more tests
R=adonovan
CC=golang-dev
https://golang.org/cl/11726043
Reduces by 94% the number of wrappers created during the tests.
(No appreciable difference in running time, sadly.)
R=gri
CC=golang-dev
https://golang.org/cl/11619043
- treat receivers like ordinary parameters when checking signatures;
concentrate all respective checks in one place
- continue to type-check methods even if receiver base type does not
satisfy receiver type criteria (comes for free)
- don't ignore blank _ methods anymore
- various related cleanups
As a consequence, the resolving needs one less internal phase.
R=adonovan
CC=golang-dev
https://golang.org/cl/11591045
Phrases like "returns whether or not the image is opaque" could be
describing what the function does (it always returns, regardless of
the opacity) or what it returns (a boolean indicating the opacity).
Even when the "or not" is missing, the phrasing is bizarre.
Go with "reports whether", which is still clunky but at least makes
it clear we're talking about the return value.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11458046
I'd like to make vet work as a filter, but passing /dev/stdin as a
command line argument doesn't work. This at least makes it not panic.
R=r
CC=golang-dev
https://golang.org/cl/11521045
Details:
- emitImplicitSelections now emits common code for implicit
field selections in both method and field lookups.
The last iteration over the LookupFieldOrMethod indices---the explicit,
final index---is handled by the caller.
- anonFieldPath, candidate and the BFS algo in buildMethodSet are all gone.
R=gri
CC=golang-dev
https://golang.org/cl/11576045
Temporarily remove Field objects in favor of Vars for struct fields.
In forthcoming CL, Fields will play the symmetric role to Methods, and
serve as lookup results including index information.
R=adonovan
CC=golang-dev
https://golang.org/cl/11594043
The exported Server becomes handlerServer, and part of Presentation
now. Presentation is also now an http.Handler with its own
internal mux (a detail, which might go away).
main.go becomes ever simpler.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11505043