From add8028eb9925db0ec9d3d0f95dec65c8cab1d96 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 9 Nov 2016 16:11:50 -0800 Subject: go/types: remove unused alias-related testdata files They interfere with gofmt -w across this directory. Follow-up on https://go-review.googlesource.com/32819. For #16339 (comment). Change-Id: I4298b6117d89517d4fe6addce3942d950d821817 Reviewed-on: https://go-review.googlesource.com/33019 Reviewed-by: Matthew Dempsky --- src/go/types/testdata/alias.go | 21 ------- src/go/types/testdata/aliasdecl.src | 111 ------------------------------------ 2 files changed, 132 deletions(-) delete mode 100644 src/go/types/testdata/alias.go delete mode 100644 src/go/types/testdata/aliasdecl.src diff --git a/src/go/types/testdata/alias.go b/src/go/types/testdata/alias.go deleted file mode 100644 index 40111fb060..0000000000 --- a/src/go/types/testdata/alias.go +++ /dev/null @@ -1,21 +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. - -// Used by TestAliases (api_test.go). - -package alias - -import ( - "go/build" - "math" -) - -const Pi1 => math.Pi -const Pi2 => math.Pi // cause the same object to be exported multiple times (issue 17726) - -var Default => build.Default - -type Context => build.Context - -func Sin => math.Sin diff --git a/src/go/types/testdata/aliasdecl.src b/src/go/types/testdata/aliasdecl.src deleted file mode 100644 index 074732df0c..0000000000 --- a/src/go/types/testdata/aliasdecl.src +++ /dev/null @@ -1,111 +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. - -package aliasdecl - -import ( - "flag" - "fmt" // use at most once (to test "imported but not used" error) - "go/build" - . "go/build" - "io" - "math" - "unsafe" -) - -// helper -var before struct { - f int -} - -// aliases must refer to package-qualified identifiers -type _ => _ /* ERROR "_ is not a package-qualified identifier" */ -type t1 => _ /* ERROR "_ is not a package-qualified identifier" */ - -const _ => iota /* ERROR "iota is not a package-qualified identifier" */ -type _ => int /* ERROR "int is not a package-qualified identifier" */ - -const c => iota /* ERROR "iota is not a package-qualified identifier" */ -type t2 => int /* ERROR "int is not a package-qualified identifier" */ - -// dot-imported identifiers are not qualified identifiers -// TODO(gri) fix error printing - should not print a qualified identifier... -var _ => Default /* ERROR "Default is not a package-qualified identifier" */ - -// qualified identifiers must start with a package -var _ => before /* ERROR "before.f is not a package-qualified identifier" */ .f -func _ => before /* ERROR "before.f is not a package-qualified identifier" */ .f -var _ => after /* ERROR "after.m is not a package-qualified identifier" */ .m -func _ => after /* ERROR "after.m is not a package-qualified identifier" */ .m - -var v1 => before /* ERROR "before.f is not a package-qualified identifier" */ .f -func f1 => before /* ERROR "before.f is not a package-qualified identifier" */ .f -var v2 => after /* ERROR "after.m is not a package-qualified identifier" */ .m -func f2 => after /* ERROR "after.m is not a package-qualified identifier" */ .m - -// TODO(gri) fix error printing - should print correct qualified identifier... -var _ => Default /* ERROR "Default.ARCH is not a package-qualified identifier" */ .ARCH -var _ Context // use dot-imported package go/build - -// aliases may not refer to package unsafe -type ptr => unsafe /* ERROR "refers to package unsafe" */ .Pointer -func size => unsafe /* ERROR "refers to package unsafe" */ .Sizeof - -// aliases must refer to entities of the same kind -const _ => math.Pi -const pi => math.Pi -const pi1 => math /* ERROR "math.Sin.* is not a constant" */ .Sin - -type _ => io.Writer -type writer => io.Writer -type writer1 => math /* ERROR "math.Sin.* is not a type" */ .Sin - -var _ => build.Default -var def => build.Default -var def1 => build /* ERROR "build.Import.* is not a variable" */ .Import - -func _ => math.Sin -func sin => math.Sin -func sin1 => math /* ERROR "math.Pi.* is not a function" */ .Pi - -// using an incorrectly declared alias should not lead to more errors -const _ = pi1 -type _ writer1 -var _ def1 = 0 -var _ = sin1 - -// aliases may not be called init -func init /* ERROR "cannot declare init" */ => flag.Parse -func _ => flag.Parse // use package flag - -// alias reference to a package marks package as used -func _ => fmt.Println - -// re-exported aliases -const Pi => math.Pi - -type Writer => io.Writer - -var Def => build.Default - -func Sin => math.Sin - -// const aliases may appear in "iota" context -// (this verifies a type-checker internal assertion) -const ( - _ = iota - pi2 => math.Pi -) - -// type aliases denote identical types -type myPackage => build.Package - -var pkg myPackage -var _ build.Package = pkg // valid assignment -var _ *build.Package = &pkg // valid assignment - -// helper -type after struct{} - -func (after) m() {} -- cgit v1.2.3-54-g00ecf