go/gcimporter15: revert user-visible changes related to aliases

Reason: Decision to back out current alias implementation.
For golang/go#16339 (comment).

Change-Id: Id2a394d78a8661c767bcc05370b81f79d9bfb714
Reviewed-on: https://go-review.googlesource.com/32756
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Manghane <cmang@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
diff --git a/go/gcimporter15/bexport.go b/go/gcimporter15/bexport.go
index 0395238..c414c7a 100644
--- a/go/gcimporter15/bexport.go
+++ b/go/gcimporter15/bexport.go
@@ -203,19 +203,20 @@
 		p.paramList(sig.Params(), sig.Variadic())
 		p.paramList(sig.Results(), false)
 
-	case *types_Alias:
-		// make sure the original is exported before the alias
-		// (if the alias declaration was invalid, orig will be nil)
-		orig := original(obj)
-		if orig != nil && !p.reexported[orig] {
-			p.obj(orig)
-			p.reexported[orig] = true
-		}
+	// Alias-related code. Keep for now.
+	// case *types_Alias:
+	// 	// make sure the original is exported before the alias
+	// 	// (if the alias declaration was invalid, orig will be nil)
+	// 	orig := original(obj)
+	// 	if orig != nil && !p.reexported[orig] {
+	// 		p.obj(orig)
+	// 		p.reexported[orig] = true
+	// 	}
 
-		p.tag(aliasTag)
-		p.pos(obj)
-		p.string(obj.Name())
-		p.qualifiedName(orig)
+	// 	p.tag(aliasTag)
+	// 	p.pos(obj)
+	// 	p.string(obj.Name())
+	// 	p.qualifiedName(orig)
 
 	default:
 		log.Fatalf("gcimporter: unexpected object %v (%T)", obj, obj)
diff --git a/go/gcimporter15/bexport18_test.go b/go/gcimporter15/bexport18_test.go
index e551893..d0decdd 100644
--- a/go/gcimporter15/bexport18_test.go
+++ b/go/gcimporter15/bexport18_test.go
@@ -2,7 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build go1.8
+// Alias-related code. Keep for now.
+// +build ignore
 
 package gcimporter_test
 
@@ -16,7 +17,7 @@
 	gcimporter "golang.org/x/tools/go/gcimporter15"
 )
 
-func TestInvalidAlias(t *testing.T) {
+func disabledTestInvalidAlias(t *testing.T) {
 	// parse and typecheck
 	const src = "package p; func InvalidAlias => foo.f"
 	fset1 := token.NewFileSet()
diff --git a/go/gcimporter15/bimport.go b/go/gcimporter15/bimport.go
index 75eacc7..b3fe961 100644
--- a/go/gcimporter15/bimport.go
+++ b/go/gcimporter15/bimport.go
@@ -288,7 +288,11 @@
 		if pkg, name := p.qualifiedName(); pkg != nil {
 			orig = pkg.Scope().Lookup(name)
 		}
-		p.declare(types_NewAlias(pos, p.pkgList[0], name, orig))
+		// Alias-related code. Keep for now.
+		_ = pos
+		_ = name
+		_ = orig
+		// p.declare(types_NewAlias(pos, p.pkgList[0], name, orig))
 
 	default:
 		errorf("unexpected object tag %d", tag)
diff --git a/go/gcimporter15/gcimporter_test.go b/go/gcimporter15/gcimporter_test.go
index 8941cfb..e4e481d 100644
--- a/go/gcimporter15/gcimporter_test.go
+++ b/go/gcimporter15/gcimporter_test.go
@@ -130,6 +130,8 @@
 	return
 }
 
+const testfile = "exports.go"
+
 func TestImportTestdata(t *testing.T) {
 	// This package only handles gc export data.
 	if runtime.Compiler != "gc" {
diff --git a/go/gcimporter15/newalias16.go b/go/gcimporter15/newalias16.go
deleted file mode 100644
index 8ffcbb7..0000000
--- a/go/gcimporter15/newalias16.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-// +build go1.6,!go1.8
-
-package gcimporter
-
-import (
-	"go/token"
-	"go/types"
-)
-
-type types_Alias struct {
-	types.Object
-	dummy int
-} // satisfies types.Object but will never be encountered
-
-func types_NewAlias(pos token.Pos, pkg *types.Package, name string, orig types.Object) types.Object {
-	errorf("unexpected alias in non-Go1.8 export data: %s.%s => %v", pkg.Name(), name, orig) // panics
-	panic("unreachable")
-}
-
-func original(types.Object) types.Object {
-	panic("unreachable")
-}
-
-const testfile = "exports17.go"
diff --git a/go/gcimporter15/newalias18.go b/go/gcimporter15/newalias18.go
deleted file mode 100644
index 56740c1..0000000
--- a/go/gcimporter15/newalias18.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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.
-
-// +build go1.8
-
-package gcimporter
-
-import "go/types"
-
-type types_Alias => types.Alias
-
-func types_NewAlias => types.NewAlias
-
-// TODO(gri) Consider exporting this functionality from go/types (issue 17730).
-func original(obj types.Object) types.Object {
-	if alias, ok := obj.(*types.Alias); ok {
-		return alias.Orig()
-	}
-	return obj
-}
-
-const testfile = "exports18.go"
diff --git a/go/gcimporter15/testdata/exports17.go b/go/gcimporter15/testdata/exports.go
similarity index 100%
rename from go/gcimporter15/testdata/exports17.go
rename to go/gcimporter15/testdata/exports.go
diff --git a/go/gcimporter15/testdata/exports18.go b/go/gcimporter15/testdata/exports18.go
deleted file mode 100644
index 0033f30..0000000
--- a/go/gcimporter15/testdata/exports18.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2011 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.
-
-// This file is used to generate an object file which
-// serves as test file for gcimporter_test.go.
-
-package exports
-
-import (
-	"go/ast"
-	"go/build"
-	"math"
-)
-
-// Issue 3682: Correctly read dotted identifiers from export data.
-const init1 = 0
-
-func init() {}
-
-const (
-	C0 int = 0
-	C1     = 3.14159265
-	C2     = 2.718281828i
-	C3     = -123.456e-789
-	C4     = +123.456E+789
-	C5     = 1234i
-	C6     = "foo\n"
-	C7     = `bar\n`
-)
-
-const (
-	C8 => math.Pi
-)
-
-type (
-	T1  int
-	T2  [10]int
-	T3  []int
-	T4  *int
-	T5  chan int
-	T6a chan<- int
-	T6b chan (<-chan int)
-	T6c chan<- (chan int)
-	T7  <-chan *ast.File
-	T8  struct{}
-	T9  struct {
-		a    int
-		b, c float32
-		d    []string `go:"tag"`
-	}
-	T10 struct {
-		T8
-		T9
-		_ *T10
-	}
-	T11 map[int]string
-	T12 interface{}
-	T13 interface {
-		m1()
-		m2(int) float32
-	}
-	T14 interface {
-		T12
-		T13
-		m3(x ...struct{}) []T9
-	}
-	T15 func()
-	T16 func(int)
-	T17 func(x int)
-	T18 func() float32
-	T19 func() (x float32)
-	T20 func(...interface{})
-	T21 struct{ next *T21 }
-	T22 struct{ link *T23 }
-	T23 struct{ link *T22 }
-	T24 *T24
-	T25 *T26
-	T26 *T27
-	T27 *T25
-	T28 func(T28) T28
-)
-
-type (
-	T29 => ast.File
-	T30 => build.Context
-)
-
-var (
-	V0 int
-	V1         = -991.0
-	V2 float32 = 1.2
-)
-
-var (
-	V3 => build.Default
-)
-
-func F1()         {}
-func F2(x int)    {}
-func F3() int     { return 0 }
-func F4() float32 { return 0 }
-func F5(a, b, c int, u, v, w struct{ x, y T1 }, more ...interface{}) (p, q, r chan<- T10)
-
-func (p *T1) M1()
-
-func F6 => math.Sin
-func F7 => ast.IsExported
-func F8 => build.Import