Commit add8028e authored by Robert Griesemer's avatar Robert Griesemer

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/33019Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 2f2b5785
// 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
// 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() {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment