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 | a43350153f15b0d8c91b0aa81c4604c94d2ef81f (patch) | |
tree | f9ab5c2dd98da17539cf7dd01813e6caf6848b78 /test/syntax/topexpr.go | |
parent | 57333596d7791df394bae8e3f50b1923e63c92cb (diff) | |
download | golang-a43350153f15b0d8c91b0aa81c4604c94d2ef81f.tar.gz |
gc: more specific error for statements at top level
R=ken2, r, ken3
CC=golang-dev
http://codereview.appspot.com/1006041
Diffstat (limited to 'test/syntax/topexpr.go')
-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 000000000..83de49075 --- /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" + |