1
0
mirror of https://github.com/golang/go synced 2024-10-03 19:21:21 -06:00
go/test/alias3.dir/a.go
Robert Griesemer 03d81b5ed9 cmd/compile: import/export of alias declarations
This CL completes support for alias declarations in the compiler.

Also:
- increased export format version
- updated various comments

For #16339.
Fixes #17487.

Change-Id: Ic6945fc44c0041771eaf9dcfe973f601d14de069
Reviewed-on: https://go-review.googlesource.com/32090
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-27 17:44:45 +00:00

55 lines
952 B
Go

// 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 a
import (
"bytes"
"go/build"
"io"
"math"
)
func F(c *build.Context, w io.Writer) {}
func Inlined() bool { var w Writer; return w == nil }
func Check() {
if Pi != math.Pi {
panic(0)
}
var w Writer
F(new(Context), w)
F(new(build.Context), bytes.NewBuffer(nil))
if &Default != &build.Default {
panic(1)
}
if Sin(1) != math.Sin(1) {
panic(2)
}
var _ *LimitedReader = new(LimitedReader2)
}
// export aliases
const Pi => math.Pi
type (
Context => build.Context // not an interface
Writer => io.Writer // interface
)
// different aliases may refer to the same original
type LimitedReader => io.LimitedReader
type LimitedReader2 => io.LimitedReader
var Default => build.Default
var Default2 => build.Default
func Sin => math.Sin
func Sin2 => math.Sin