diff --git a/go/gcimporter15/bexport.go b/go/gcimporter15/bexport.go index 0395238e..c414c7a7 100644 --- a/go/gcimporter15/bexport.go +++ b/go/gcimporter15/bexport.go @@ -203,19 +203,20 @@ func (p *exporter) obj(obj types.Object) { 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 e5518938..d0decdd4 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 @@ import ( 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 75eacc71..b3fe9617 100644 --- a/go/gcimporter15/bimport.go +++ b/go/gcimporter15/bimport.go @@ -288,7 +288,11 @@ func (p *importer) obj(tag int) { 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 8941cfb3..e4e481db 100644 --- a/go/gcimporter15/gcimporter_test.go +++ b/go/gcimporter15/gcimporter_test.go @@ -130,6 +130,8 @@ func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) { 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 8ffcbb7d..00000000 --- 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 56740c1c..00000000 --- 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 0033f302..00000000 --- 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