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

Issue 105060044: go.tools/go: separate interface construction from metho... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years ago by pcc
Modified:
10 years, 11 months ago
Reviewers:
gri
CC:
gri, dave_cheney.net, gmk, adonovan, golang-codereviews
Visibility:
Public.

Description

go.tools/go: separate interface construction from method set construction We introduce a method (*Interface).Complete(), which is intended to be called from clients after all embedded interfaces have been fully defined. For importers, this will definitely be the case after the import has finished, so each importer have been updated to do so, with the exception of the gcimporter, which does not use embedded interfaces, therefore Complete() can be called immediately after construction. Building the method set separately from the constructor type caused some problems with go/importer, which copies the types.Interface object, leading to there existing two almost-identical interface types referenced from interface method receivers, only one of which has been completed. To avoid this situation, the importer has been modified to construct the interface object only once. Fixes issue 8177.

Patch Set 1 #

Patch Set 2 : diff -r 15d5d18b23ba https://code.google.com/p/go.tools #

Patch Set 3 : diff -r 15d5d18b23ba https://code.google.com/p/go.tools #

Total comments: 4

Patch Set 4 : diff -r 15d5d18b23ba https://code.google.com/p/go.tools #

Total comments: 20

Patch Set 5 : diff -r 11d41c5f9e17 https://code.google.com/p/go.tools #

Total comments: 2

Patch Set 6 : diff -r 11d41c5f9e17 https://code.google.com/p/go.tools #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -31 lines) Patch
M go/gccgoimporter/parser.go View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M go/gcimporter/gcimporter.go View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M go/importer/export.go View 1 2 3 4 5 1 chunk +13 lines, -8 lines 0 comments Download
M go/importer/import.go View 1 2 3 4 3 chunks +15 lines, -3 lines 0 comments Download
M go/importer/import_test.go View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M go/pointer/gen.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M go/types/type.go View 1 2 3 4 2 chunks +37 lines, -17 lines 0 comments Download
M go/types/universe.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 14
pcc
11 years ago (2014-06-11 02:06:23 UTC) #1
dave_cheney.net
https://codereview.appspot.com/105060044/diff/40001/go/gccgoimporter/parser.go File go/gccgoimporter/parser.go (right): https://codereview.appspot.com/105060044/diff/40001/go/gccgoimporter/parser.go#newcode804 go/gccgoimporter/parser.go:804: if it, _ := typ.(*types.Interface); it != nil { ...
11 years ago (2014-06-11 06:39:48 UTC) #2
gmk
I don't think this is the right solution; it adds complexity where simplification is needed. ...
11 years ago (2014-06-11 10:26:22 UTC) #3
pcc
On 2014/06/11 10:26:22, gmk wrote: > I don't think this is the right solution; it ...
11 years ago (2014-06-11 17:50:43 UTC) #4
pcc
https://codereview.appspot.com/105060044/diff/40001/go/gccgoimporter/parser.go File go/gccgoimporter/parser.go (right): https://codereview.appspot.com/105060044/diff/40001/go/gccgoimporter/parser.go#newcode804 go/gccgoimporter/parser.go:804: if it, _ := typ.(*types.Interface); it != nil { ...
11 years ago (2014-06-11 17:59:23 UTC) #5
gmk
On 2014/06/11 17:50:43, pcc wrote: > On 2014/06/11 10:26:22, gmk wrote: > > I don't ...
11 years ago (2014-06-11 19:12:14 UTC) #6
pcc
On 2014/06/11 19:12:14, gmk wrote: > On 2014/06/11 17:50:43, pcc wrote: > > On 2014/06/11 ...
11 years ago (2014-06-11 21:05:12 UTC) #7
adonovan
On 2014/06/11 19:12:14, gmk wrote: > Is it a goal of go/types to ensure that ...
11 years ago (2014-06-11 21:12:40 UTC) #8
adonovan
On 2014/06/11 21:05:12, pcc wrote: > I believe that go/ssa makes that assumption for Func ...
11 years ago (2014-06-11 21:26:23 UTC) #9
gri
Please add to the CL desc Fixes issue 8177. https://codereview.appspot.com/105060044/diff/40002/go/gcimporter/gcimporter.go File go/gcimporter/gcimporter.go (right): https://codereview.appspot.com/105060044/diff/40002/go/gcimporter/gcimporter.go#newcode605 go/gcimporter/gcimporter.go:605: ...
11 years ago (2014-06-11 23:23:10 UTC) #10
pcc
https://codereview.appspot.com/105060044/diff/40002/go/gcimporter/gcimporter.go File go/gcimporter/gcimporter.go (right): https://codereview.appspot.com/105060044/diff/40002/go/gcimporter/gcimporter.go#newcode605 go/gcimporter/gcimporter.go:605: return it On 2014/06/11 23:23:09, gri wrote: > return ...
10 years, 11 months ago (2014-06-27 00:50:49 UTC) #11
gri
LGTM Apologies for the delay, this fell under the table somehow. Please address the comment ...
10 years, 11 months ago (2014-07-10 00:27:43 UTC) #12
pcc
https://codereview.appspot.com/105060044/diff/60001/go/importer/export.go File go/importer/export.go (right): https://codereview.appspot.com/105060044/diff/60001/go/importer/export.go#newcode338 go/importer/export.go:338: if _, ok := recv.Type().Underlying().(*types.Interface); recv != nil && ...
10 years, 11 months ago (2014-07-10 01:55:02 UTC) #13
gri
10 years, 11 months ago (2014-07-10 03:00:52 UTC) #14
*** Submitted as
https://code.google.com/p/go/source/detail?r=96d013ae993d&repo=tools ***

go.tools/go: separate interface construction from method set construction

We introduce a method (*Interface).Complete(), which is intended
to be called from clients after all embedded interfaces have been
fully defined. For importers, this will definitely be the case
after the import has finished, so each importer have been updated
to do so, with the exception of the gcimporter, which does not use
embedded interfaces, therefore Complete() can be called immediately
after construction.

Building the method set separately from the constructor type caused
some problems with go/importer, which copies the types.Interface
object, leading to there existing two almost-identical interface
types referenced from interface method receivers, only one of which
has been completed. To avoid this situation, the importer has been
modified to construct the interface object only once.

Fixes issue 8177.

LGTM=gri
R=gri, dave, gordon.klaus, adonovan
CC=golang-codereviews
https://codereview.appspot.com/105060044

Committer: Robert Griesemer <gri@golang.org>
Sign in to reply to this message.

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