1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:34:53 -07:00
go/test/alias3.dir/c.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

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()
}