Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1180)

Issue 4314054: code review 4314054: go/types: New Go type hierarchy implementation for AST. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 12 months ago by gri
Modified:
13 years, 11 months ago
Reviewers:
eds, rsc
CC:
eds, rog, golang-dev
Visibility:
Public.

Description

go/types: New Go type hierarchy implementation for AST. This CL defines a new, more Go-like representation of Go types (different structs for different types as opposed to a single Type node). It also implements an ast.Importer for object/archive files generated by the gc compiler tool chain. Besides the individual type structs, the main difference is the handling of named types: In the old world, a named type had a non-nil *Object pointer but otherwise looked no different from other types. In this new model, named types have their own representation types.Name. As a result, resolving cycles is a bit simpler during construction, at the cost of having to deal with types.Name nodes explicitly later. It remains to be seen if this is a good approach. Nevertheless, code involving types reads more nicely and benefits from full type checking. Also, the representation seems to more closely match the spec wording. Credits: The original version of the gc importer was written by Evan Shaw (chickencha@gmail.com). The new version in this CL is based largely on Evan's original code but contains bug fixes, a few simplifications, some restructuring, and was adjusted to use the new type hierarchy. I have added a comprehensive test that imports all packages found under $GOROOT/pkg (with a 3s time-out to limit the run-time of the test). Run gotest -v for details. The original version of ExportData (exportdata.go) was written by Russ Cox (rsc@golang.org). The current version is returning the internal buffer positioned at the beginning of the export data instead of printing the export data to stdout. With the new types package, the existing in-progress typechecker package is deprecated. I will delete it once all functionality has been brought over.

Patch Set 1 #

Patch Set 2 : diff -r cf1342f0c8bd https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 9bb646cecf58 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r a15522fba283 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r a15522fba283 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r f782663275a7 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 9f27edac5018 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 7df08a2207e6 https://go.googlecode.com/hg/ #

Patch Set 9 : diff -r 1abd0a633574 https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r b002b8e25d25 https://go.googlecode.com/hg/ #

Patch Set 11 : diff -r b002b8e25d25 https://go.googlecode.com/hg/ #

Patch Set 12 : diff -r b002b8e25d25 https://go.googlecode.com/hg/ #

Patch Set 13 : diff -r b002b8e25d25 https://go.googlecode.com/hg/ #

Patch Set 14 : diff -r b002b8e25d25 https://go.googlecode.com/hg/ #

Total comments: 18

Patch Set 15 : diff -r fd6ade18359d https://go.googlecode.com/hg/ #

Total comments: 63

Patch Set 16 : diff -r 56f8b1cc5129 https://go.googlecode.com/hg/ #

Patch Set 17 : diff -r 56f8b1cc5129 https://go.googlecode.com/hg/ #

Patch Set 18 : diff -r ebef2da9ab43 https://go.googlecode.com/hg/ #

Patch Set 19 : diff -r ebef2da9ab43 https://go.googlecode.com/hg/ #

Patch Set 20 : diff -r ebef2da9ab43 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 21 : diff -r ebef2da9ab43 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 22 : diff -r ebef2da9ab43 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1715 lines, -1 line) Patch
M src/pkg/Makefile View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/go/typechecker/typechecker.go View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
A src/pkg/go/types/Makefile View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +15 lines, -0 lines 0 comments Download
A src/pkg/go/types/const.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +347 lines, -0 lines 0 comments Download
A src/pkg/go/types/exportdata.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +135 lines, -0 lines 0 comments Download
A src/pkg/go/types/gcimporter.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +786 lines, -0 lines 0 comments Download
A src/pkg/go/types/gcimporter_test.go View 1 2 3 4 5 6 7 8 9 1 chunk +106 lines, -0 lines 0 comments Download
A src/pkg/go/types/testdata/exports.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +89 lines, -0 lines 0 comments Download
A src/pkg/go/types/types.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +122 lines, -0 lines 0 comments Download
A src/pkg/go/types/universe.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +113 lines, -0 lines 0 comments Download

Messages

Total messages: 21
gri
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 11 months ago (2011-04-06 01:30:39 UTC) #1
gri
hg mail missed most of the CL: Here is what I have: 4314054: go/types: New ...
13 years, 11 months ago (2011-04-06 01:45:41 UTC) #2
eds
http://codereview.appspot.com/4314054/diff/27001/src/pkg/go/types/const.go File src/pkg/go/types/const.go (right): http://codereview.appspot.com/4314054/diff/27001/src/pkg/go/types/const.go#newcode44 src/pkg/go/types/const.go:44: func NewConst(kind token.Token, lit string) Const { There should ...
13 years, 11 months ago (2011-04-06 02:04:46 UTC) #3
rog
http://codereview.appspot.com/4314054/diff/27001/src/pkg/go/types/const.go File src/pkg/go/types/const.go (right): http://codereview.appspot.com/4314054/diff/27001/src/pkg/go/types/const.go#newcode100 src/pkg/go/types/const.go:100: switch b := y.val.(type) { switch y.val.(type) { http://codereview.appspot.com/4314054/diff/27001/src/pkg/go/types/const.go#newcode113 ...
13 years, 11 months ago (2011-04-06 08:35:24 UTC) #4
gri
PTAL. - gri http://codereview.appspot.com/4314054/diff/27001/src/pkg/go/types/const.go File src/pkg/go/types/const.go (right): http://codereview.appspot.com/4314054/diff/27001/src/pkg/go/types/const.go#newcode44 src/pkg/go/types/const.go:44: func NewConst(kind token.Token, lit string) Const ...
13 years, 11 months ago (2011-04-07 00:05:15 UTC) #5
eds
LGTM On Thu, Apr 7, 2011 at 12:05 PM, <gri@golang.org> wrote: >> There should be ...
13 years, 11 months ago (2011-04-07 01:09:26 UTC) #6
rsc
http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/const.go File src/pkg/go/types/const.go (right): http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/const.go#newcode76 src/pkg/go/types/const.go:76: // NewZero creates a new zero constant for the ...
13 years, 11 months ago (2011-04-07 16:27:19 UTC) #7
rsc
Code for finding the import data. package main import ( "bufio" "fmt" "io" "log" "os" ...
13 years, 11 months ago (2011-04-07 16:28:32 UTC) #8
gri
PTAL http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/const.go File src/pkg/go/types/const.go (right): http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/const.go#newcode76 src/pkg/go/types/const.go:76: // NewZero creates a new zero constant for ...
13 years, 11 months ago (2011-04-08 02:41:32 UTC) #9
rsc
http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/types.go File src/pkg/go/types/types.go (right): http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/types.go#newcode45 src/pkg/go/types/types.go:45: Ellipsis bool // true for "...Elt" types On 2011/04/08 ...
13 years, 11 months ago (2011-04-08 03:25:43 UTC) #10
rsc
LGTM I meant to LGTM the last set of comments. I strongly believe that IsVariadic ...
13 years, 11 months ago (2011-04-08 03:48:58 UTC) #11
gri
PTAL http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/types.go File src/pkg/go/types/types.go (right): http://codereview.appspot.com/4314054/diff/27002/src/pkg/go/types/types.go#newcode45 src/pkg/go/types/types.go:45: Ellipsis bool // true for "...Elt" types On ...
13 years, 11 months ago (2011-04-08 04:08:59 UTC) #12
rsc
LGTM Feel free to fix and submit. http://codereview.appspot.com/4314054/diff/21003/src/pkg/go/types/gcimporter.go File src/pkg/go/types/gcimporter.go (right): http://codereview.appspot.com/4314054/diff/21003/src/pkg/go/types/gcimporter.go#newcode399 src/pkg/go/types/gcimporter.go:399: assert(!*isVariadic) Seems ...
13 years, 11 months ago (2011-04-08 04:18:02 UTC) #13
gri
On Thu, Apr 7, 2011 at 9:18 PM, <rsc@golang.org> wrote: > LGTM > > Feel ...
13 years, 11 months ago (2011-04-08 04:25:21 UTC) #14
rsc
> As an aside: The parsing of ... (here and in go/parser) would actually > ...
13 years, 11 months ago (2011-04-08 04:35:56 UTC) #15
gri
On Thu, Apr 7, 2011 at 9:35 PM, Russ Cox <rsc@golang.org> wrote: >> As an ...
13 years, 11 months ago (2011-04-08 04:39:29 UTC) #16
gri
Hello eds, rog, rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 11 months ago (2011-04-08 04:40:36 UTC) #17
gri
*** Submitted as http://code.google.com/p/go/source/detail?r=8b0c9fe4b6ea *** go/types: New Go type hierarchy implementation for AST. This CL ...
13 years, 11 months ago (2011-04-08 04:40:45 UTC) #18
rsc
LGTM
13 years, 11 months ago (2011-04-08 04:41:27 UTC) #19
gri
I don't know why hg sent this. Please ignore. - gri On Thu, Apr 7, ...
13 years, 11 months ago (2011-04-08 04:41:59 UTC) #20
rsc
13 years, 11 months ago (2011-04-08 04:43:20 UTC) #21
On Fri, Apr 8, 2011 at 00:41, Robert Griesemer <gri@golang.org> wrote:
> I don't know why hg sent this. Please ignore.
> - gri

I do.  That can be the next codereview bug I fix.
The "Mailed:" bit is not propagated during clpatch.

Russ
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b