From 5fd4f768029cd8f84063d08e4a7787689ab6c09b Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 19 Nov 2009 00:04:30 -0800 Subject: [PATCH] bug219: parsing difficulties with 6g R=r, rsc https://golang.org/cl/157085 --- test/bugs/bug219.go | 35 +++++++++++++++++++++++++++++++++++ test/golden.out | 4 ++++ 2 files changed, 39 insertions(+) create mode 100644 test/bugs/bug219.go diff --git a/test/bugs/bug219.go b/test/bugs/bug219.go new file mode 100644 index 0000000000..aee07cce7e --- /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 8a1c3af59b..64bfd6ecc7 100644 --- a/test/golden.out +++ b/test/golden.out @@ -145,3 +145,7 @@ panic PC=xxx =========== bugs/bug218.go : fatal error: dowidth: unknown type: blank BUG: bug218 + +=========== bugs/bug219.go +bugs/bug219.go:16: syntax error near if +BUG: bug219