diff options
author | Robert Griesemer <gri@golang.org> | 2016-10-27 12:53:25 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2016-10-27 20:01:20 +0000 |
commit | 50f66fbb66c2f3cdfc9f942c5e11cc1b9ec17a73 (patch) | |
tree | caa84620c948ba000d49fa0b202d04c98787a6ae /test/alias2.go | |
parent | 89632aa1832a02e36acd458b3b35257d8133ae0c (diff) | |
download | go-50f66fbb66c2f3cdfc9f942c5e11cc1b9ec17a73.tar.gz go-50f66fbb66c2f3cdfc9f942c5e11cc1b9ec17a73.zip |
cmd/compile: disallow "init" as alias
Fixes #17637.
Change-Id: I5af63b8277c0a0f9fef4880992bcb925ca088687
Reviewed-on: https://go-review.googlesource.com/32106
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/alias2.go')
-rw-r--r-- | test/alias2.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/alias2.go b/test/alias2.go index f160d384b1..6fad914420 100644 --- a/test/alias2.go +++ b/test/alias2.go @@ -9,6 +9,7 @@ package p import ( + "flag" "fmt" // use at most once (to test "imported but not used" error) "go/build" . "go/build" @@ -74,13 +75,19 @@ func _ => math.Sin func sin => math.Sin func sin1 => math.Pi // ERROR "math.Pi is not a function" +// aliases may not be called init +func init => flag.Parse // ERROR "cannot declare init" + // alias reference to a package marks package as used func _ => fmt.Println // re-exported aliases const Pi => math.Pi + type Writer => io.Writer + var Def => build.Default + func Sin => math.Sin // type aliases denote identical types |