summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-19 00:04:30 -0800
committerRobert Griesemer <gri@golang.org>2009-11-19 00:04:30 -0800
commitc8e1ce33c55dbfaf099472521fd7076d5725f3f0 (patch)
tree07f1a6ff7b9fb5ab67a1a2c4eddd74fead7adcfd
parentce677f006e4b3bf09818317edc26c2f12114148d (diff)
downloadgo-c8e1ce33c55dbfaf099472521fd7076d5725f3f0.tar.gz
bug219: parsing difficulties with 6g
R=r, rsc http://codereview.appspot.com/157085
-rw-r--r--test/bugs/bug219.go35
-rw-r--r--test/golden.out4
2 files changed, 39 insertions, 0 deletions
diff --git a/test/bugs/bug219.go b/test/bugs/bug219.go
new file mode 100644
index 000000000..aee07cce7
--- /dev/null
+++ b/test/bugs/bug219.go
@@ -0,0 +1,35 @@
+// $G $D/$F.go || echo BUG: bug219
+
+// Copyright 2009 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 f(func()) int { return 0 }
+
+// this doesn't work:
+// bug219.go:16: syntax error near if
+func g1() {
+ if x := f(func() {
+ if {}
+ }); {
+ }
+}
+
+// this works
+func g2() {
+ if x := f(func() {
+ //if {}
+ }); {
+ }
+}
+
+// this works
+func g3() {
+ x := f(func() {
+ if {}
+ });
+ if {
+ }
+}
diff --git a/test/golden.out b/test/golden.out
index 8a1c3af59..64bfd6ecc 100644
--- a/test/golden.out
+++ b/test/golden.out
@@ -145,3 +145,7 @@ panic PC=xxx
=========== bugs/bug218.go
<epoch>: fatal error: dowidth: unknown type: blank
BUG: bug218
+
+=========== bugs/bug219.go
+bugs/bug219.go:16: syntax error near if
+BUG: bug219