From c550f66b0b48fb80f7076e0a5f8a0d736e3bb7bd Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 15 Jul 2016 14:31:40 -0700 Subject: [PATCH] go/gcimporter15: backport of https://golang.org/cl/23606/ Change-Id: I24a6a844e179dd1b69c90c5834d7998cb963c543 Reviewed-on: https://go-review.googlesource.com/24974 Reviewed-by: Alan Donovan --- go/gcimporter15/gcimporter_test.go | 25 +++++++++++++++++++++++++ go/gcimporter15/testdata/issue15920.go | 11 +++++++++++ 2 files changed, 36 insertions(+) create mode 100644 go/gcimporter15/testdata/issue15920.go diff --git a/go/gcimporter15/gcimporter_test.go b/go/gcimporter15/gcimporter_test.go index 4265516a..16a16728 100644 --- a/go/gcimporter15/gcimporter_test.go +++ b/go/gcimporter15/gcimporter_test.go @@ -402,3 +402,28 @@ func TestIssue15517(t *testing.T) { } } } + +func TestIssue15920(t *testing.T) { + skipSpecialPlatforms(t) + + // This package only handles gc export data. + if runtime.Compiler != "gc" { + t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler) + return + } + + // On windows, we have to set the -D option for the compiler to avoid having a drive + // letter and an illegal ':' in the import path - just skip it (see also issue #3483). + if runtime.GOOS == "windows" { + t.Skip("avoid dealing with relative paths/drive letters on windows") + } + + if f := compile(t, "testdata", "issue15920.go"); f != "" { + defer os.Remove(f) + } + + imports := make(map[string]*types.Package) + if _, err := Import(imports, "./testdata/issue15920", "."); err != nil { + t.Fatal(err) + } +} diff --git a/go/gcimporter15/testdata/issue15920.go b/go/gcimporter15/testdata/issue15920.go new file mode 100644 index 00000000..c70f7d82 --- /dev/null +++ b/go/gcimporter15/testdata/issue15920.go @@ -0,0 +1,11 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +// The underlying type of Error is the underlying type of error. +// Make sure we can import this again without problems. +type Error error + +func F() Error { return nil }