go/types: some prep work for making `import "chans"` (testdata/map.go2) work

To make the import work, the import needs to be changed into
`import "./chan"`, the file testdata/chans.go2 needs to be
copies into a new directory testdata/chan and the file must
be renamed to chans.go.

But this exposes some problem with instantiating parameterized
types with other type parameters. Delaying this for now.

Change-Id: I1cd784fb89c2374131f3b1105493492eb0189abc
This commit is contained in:
Robert Griesemer 2019-08-16 12:00:23 -07:00
parent fbff5cc915
commit e73de77f33
2 changed files with 5 additions and 3 deletions

View File

@ -275,7 +275,9 @@ func checkFiles(t *testing.T, testfiles []string) {
conf.FakeImportC = true
}
conf.Trace = testing.Verbose()
conf.Importer = importer.Default()
// We don't use importer.Default() below so we can eventually
// get testdata/map.go2 to import chans (still to be fixed).
conf.Importer = importer.ForCompiler(fset, "source", nil)
conf.Error = func(err error) {
if *haltOnError {
defer panic(err)

View File

@ -89,8 +89,8 @@ func (m *Map(K, V)) InOrder() *Iterator(K, V) {
f(m.root)
sender.Close()
}()
// TODO(gri) The design doc doensn't require that we repeat the
// type parameters here. Fix the implementation.
// TODO(gri) The design draft doesn't require that we repeat
// the type parameters here. Fix the implementation.
return &Iterator(K, V){receiver}
// return &Iterator{receiver}
}