diff options
author | Russ Cox <rsc@golang.org> | 2010-04-26 22:35:27 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-04-26 22:35:27 -0700 |
commit | d6e4e18c8c806653a0d007771dd75b965574e4fe (patch) | |
tree | 4f106bf61e3432be5426ff5a21f1ea55f987aef0 /test/syntax | |
parent | 2a591bdf8a35792d67346f7516ddead9af1f078d (diff) | |
download | go-d6e4e18c8c806653a0d007771dd75b965574e4fe.tar.gz go-d6e4e18c8c806653a0d007771dd75b965574e4fe.zip |
gc: more specific error for statements at top level
R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/1006041
Diffstat (limited to 'test/syntax')
-rw-r--r-- | test/syntax/topexpr.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/syntax/topexpr.go b/test/syntax/topexpr.go new file mode 100644 index 0000000000..83de49075d --- /dev/null +++ b/test/syntax/topexpr.go @@ -0,0 +1,20 @@ +// errchk $G -e $D/$F.go + +// Copyright 2010 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 + +fmt.Printf("hello") // ERROR "non-declaration statement outside function body" + +func main() { +} + +x++ // ERROR "non-declaration statement outside function body" + +func init() { +} + +x,y := 1, 2 // ERROR "non-declaration statement outside function body" + |