mirror of
https://github.com/golang/go
synced 2024-11-18 05:54:49 -07:00
03d81b5ed9
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>
55 lines
952 B
Go
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
|