App Engine needs the whitelist file and it's cleaner if it's
in its own package where it can be imported directly, without
pushing composite.go through a pile of sed.
R=dsymonds, r
CC=golang-dev
https://golang.org/cl/12746045
It is needed after all, as I discovered in the pointer analysis.
(ssa needs more API test coverage.)
Also:
- sanity: remove debugging cruft
- promote: don't redundantly include the function's
own name in its Synthetic string.
- print: IntuitiveMethodSet utility fixes a bug in the
printing logic (for interface types, mset(*T) is empty).
The function is also used by the Oracle.
R=crawshaw
CC=golang-dev
https://golang.org/cl/13116043
&x.f, &x[0], x[i:j], &*x all must panic if x==nil.
The first three are already addressed by the semantics of
FieldAddr, IndexAddr, Slice; updated docs to reflect this.
The final case requires generation of an additional dynamic check.
See golang.org/s/go12nil for details.
Tested on $GOROOT/test/nilptr2.go (with patch from CL 13108043)
Also: remove a TODO where a no-op will do.
R=gri, crawshaw
CC=golang-dev, rsc
https://golang.org/cl/13064044
Fix bug: the Signature for an interface method wrapper
erroneously had a non-nil receiver.
Function:
- Set Pkg field non-nil even for wrappers.
It is equal to that of the wrapped function.
Only wrappers of error.Error
(and its embeddings in other interfaces) may have nil.
Sanity checker now asserts this.
- FullName() now uses .Synthetic field to discriminate
synthetic methods, not Pkg==nil.
- Fullname() uses new relType() utility to print receiver type
name unqualified if it belongs to the same package.
(Alloc.String also uses relType utility.)
CallCommon:
- Description(): fix switch logic broken when we
eliminated the Recv field.
- better docs.
R=david.crawshaw, crawshaw, gri
CC=golang-dev
https://golang.org/cl/13057043
Package.CreateTestMainFunction() creates a function called
main and adds it to the package. This function calls
testing.Main in the Go library with the appropriate arguments:
slices of test, benchmark and example functions from the
package.
Tested by running the interpreter on the following tests:
- unicode/script_test.go
- unicode/digit_test.go
- hash/crc32/crc32_test.go
- path/path_test.go
It's also covered indirectly via the pointer analysis.
R=crawshaw, gri
CC=golang-dev
https://golang.org/cl/12814046
The test would nuke the entire contents of os.TempDir on completion.
This change corrects the code to use ioutil.TempDir.
R=r, adg
CC=golang-dev
https://golang.org/cl/12796045
go/vcs exposes cmd/go/vcs.go from the `go get` command.
- Exported global variables `Verbose` and `ShowCmd` to replace `buildV` and `buildX` from cmd/go/main.go.
- Moved environment building code (envForDir, mergeEnvLists)from cmd/go/main.go to env.go
- Exported Cmd and its methods: Create, Download, Ping, TagSync, and Tags
- Exported ByCmd and FromDir functions for constructing Cmd
- Exported TagCmd
- Exported RepoRoot
- Exported RepoRootForImport* functions for constructing RepoRoot
R=golang-dev, adg, cmang, bradfitz
CC=golang-dev
https://golang.org/cl/12058054
- cleaned up surrounding code
- adjusted error message positions for too few/many argument errors
- added more conversion tests
- added all tests under test/ken to std tests
R=adonovan, r
TBR=adonovan
CC=golang-dev
https://golang.org/cl/12711043
- support Info.Scopes mapping that maps ast.Nodes
to the respective *Scope
- remove old node link from *Scope
- added corresponding API test
Also: re-enable debug mode (the faster version was
only important for the go api tool, which has its
own version now).
R=adonovan, r
CC=golang-dev
https://golang.org/cl/12552047
Provide fewer guarantees regarding the collected result
type information in types.Info if there are type errors.
Specifically, don't record nil objects in the Objects map
in case of a declaration error; instead, simply omit them.
R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/12553043
If a method cannot type check, we end up with the interface variable
m to hold <*Func, nil>. Don't put that in the map because it defeats
the usual != nil check.
R=gri, dsymonds
CC=golang-dev
https://golang.org/cl/12506043
Was broken by CL 12378043.
- factored out some error checking code
- adjusted error positions
R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/12401043
They use stuff in syscall that doesn't exist on Windows, and this test does not
parse build tags (not that we make that easy) to automatically skip them.
R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/12453043
TBR: gri
I cannot create an issue on the tracker for some reason, so here it is:
go vet contains this snippet:
if types.IsAssignableTo(typ, errorType) || types.IsAssignableTo(typ, stringerType) {
It's getting the wrong answer: It claims
interface {
f()
}
or even
interface {
f() float64
}
matches the Error and Stringer interfaces. Both of them. This causes a test failure:
$ go test code.google.com/p/go.tools/cmd/vet
BUG: errchk: testdata/print.go:124: missing expected error: '"for printf verb %s of wrong type"'
$
This worked until very recently.
R=gri
CC=golang-dev
https://golang.org/cl/12398043
The old code only got it right for Stringers (etc.) and a few other simple cases.
But the rule used by fmt.Printf for non-Stringers is that pointers to structs
print as pointers, the rest must satisfy the format verb element-wise.
Thus for example
struct {a int, b []byte}
prints with %d and %q (sic) but not %g.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12340043
This is useful for situations where one only cares about
exports, for instance (as in the goapi checker).
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/12292043
e.g.
type T int
func (T) f() {}
var t T
_ = t.f // method value: should have signature "func()", no receiver
Also:
- ssa: add sanity check that helped diagnose this.
R=gri
CC=golang-dev
https://golang.org/cl/12283043
Remove its 'name' field and treat it just like any other
ssa.Register: it gets a temp name like "t1".
Instead, give it a comment field holding its purpose, e.g, "x"
for a source-level vare, or "new", "slicelit", "complit" or
"varargs".
This improves usability of tools whose UI needs to refer to a
particular allocation site.
R=gri
CC=golang-dev
https://golang.org/cl/12273043
Moving misc/dashboard to its new home. It will be deleted
(except for misc/dashboard/codereview) from its current home
if this is approved.
R=golang-dev, bradfitz, cmang, adg
CC=golang-dev
https://golang.org/cl/12180043
Fixed several bugs:
- lhs blank identifier may be parenthesized: (_) = 0 is ok
- constant shift counts in non-constant shifts must be >= 0
- init functions must have a body
Classified currently failing tests:
- 10 classes of errors not checked at the moment
R=adonovan, r
CC=golang-dev
https://golang.org/cl/11952046
The required changes were surprisingly minimal (I was hoping for a net
code deletion) because ssa is essentially doing its own type inference
for the three value,ok operators---and it continues to have to do so.
To see why, consider:
var i interface{}; var ok bool
i, ok := (map[string]string)(nil)[""]
Before, go/types inferred interface{} for the RHS of the assignment,
and now it infers (interface{}, bool), yet neither of these is what
ssa needs: it needs to know that the map values were strings so
that it can emit a lookup of the right type followed by a conversion
from string to interface{}.
TBR=gri
CC=golang-dev
https://golang.org/cl/11988044