summaryrefslogtreecommitdiff
path: root/test/syntax/forvar.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-01-26 23:13:22 -0800
committerRuss Cox <rsc@golang.org>2010-01-26 23:13:22 -0800
commitda0f154cecf72a30fb2412aa018803208e80dde3 (patch)
tree1535ebe4c0e90e048e14683b415f114c7471341a /test/syntax/forvar.go
parent2ccb4107adca6819d7765672f49d7de7d2024736 (diff)
downloadgolang-da0f154cecf72a30fb2412aa018803208e80dde3.tar.gz
gc: improved syntax errors
* example-based syntax errors (go.errors) * enable bison's more specific errors and translate grammar token names into tokens like ++ * test cases R=ken2, r, ken3 CC=golang-dev http://codereview.appspot.com/194085
Diffstat (limited to 'test/syntax/forvar.go')
-rw-r--r--test/syntax/forvar.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/syntax/forvar.go b/test/syntax/forvar.go
new file mode 100644
index 000000000..f12ce55ca
--- /dev/null
+++ b/test/syntax/forvar.go
@@ -0,0 +1,10 @@
+// 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
+
+func main() {
+ for var x = 0; x < 10; x++ { // ERROR "var declaration not allowed in for initializer"