mirror of
https://github.com/golang/go
synced 2024-11-24 15:50:11 -07:00
67 lines
1001 B
Go
67 lines
1001 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 main
|
||
|
|
||
|
import (
|
||
|
"./a"
|
||
|
"./b"
|
||
|
"bytes"
|
||
|
"go/build"
|
||
|
"math"
|
||
|
)
|
||
|
|
||
|
func f => b.F
|
||
|
func inlined => b.Inlined
|
||
|
|
||
|
var _ func(*context, a.Writer) = f
|
||
|
|
||
|
func Check() {
|
||
|
if pi != math.Pi {
|
||
|
panic(0)
|
||
|
}
|
||
|
|
||
|
var w writer
|
||
|
b.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)
|
||
|
}
|
||
|
|
||
|
// local aliases
|
||
|
const pi => b.Pi
|
||
|
|
||
|
type (
|
||
|
context => b.Context // not an interface
|
||
|
writer => b.Writer // interface
|
||
|
)
|
||
|
|
||
|
// different aliases may refer to the same original
|
||
|
type limitedReader => b.LimitedReader
|
||
|
type limitedReader2 => b.LimitedReader2
|
||
|
|
||
|
var default_ => b.Default
|
||
|
var default2 => b.Default2
|
||
|
|
||
|
func sin => b.Sin
|
||
|
func sin2 => b.Sin
|
||
|
|
||
|
func main() {
|
||
|
a.Check()
|
||
|
b.Check()
|
||
|
Check()
|
||
|
}
|