go/test/alias3.dir/b.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

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