From e73de77f33b632ea6487d48042f4bf1236253dc4 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 16 Aug 2019 12:00:23 -0700 Subject: [PATCH] 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 --- src/go/types/check_test.go | 4 +++- src/go/types/testdata/map.go2 | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go index 86f2000ede..11d277dcdd 100644 --- a/src/go/types/check_test.go +++ b/src/go/types/check_test.go @@ -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) diff --git a/src/go/types/testdata/map.go2 b/src/go/types/testdata/map.go2 index 64f0cba4a5..82008c7f52 100644 --- a/src/go/types/testdata/map.go2 +++ b/src/go/types/testdata/map.go2 @@ -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} }