From: Ryan Hitchman Date: Mon, 2 Apr 2012 15:00:55 +0000 (-0400) Subject: gc: improve error message for composite literals with unexpected newlines X-Git-Tag: go1.1rc2~3467 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8a686792e08f1114fd7819a32d8c2e3c4ddddc14;p=gostls13.git gc: improve error message for composite literals with unexpected newlines R=golang-dev, r, rsc CC=golang-dev https://golang.org/cl/5857045 --- diff --git a/src/cmd/gc/go.errors b/src/cmd/gc/go.errors index e29cfff5bd..68a5e5af3a 100644 --- a/src/cmd/gc/go.errors +++ b/src/cmd/gc/go.errors @@ -65,6 +65,9 @@ static struct { % loadsys package imports LVAR LNAME '=' LNAME '{' LNAME ';' "need trailing comma before newline in composite literal", + % loadsys package imports LVAR LNAME '=' comptype '{' LNAME ';' + "need trailing comma before newline in composite literal", + % loadsys package imports LFUNC LNAME '(' ')' '{' LFUNC LNAME "nested func not allowed", diff --git a/src/cmd/gc/yerr.h b/src/cmd/gc/yerr.h index 588890d0ed..256c48b0ec 100644 --- a/src/cmd/gc/yerr.h +++ b/src/cmd/gc/yerr.h @@ -65,6 +65,9 @@ static struct { 425, ';', "need trailing comma before newline in composite literal", + 435, ';', + "need trailing comma before newline in composite literal", + 112, LNAME, "nested func not allowed", diff --git a/test/syntax/composite.go b/test/syntax/composite.go new file mode 100644 index 0000000000..6565334935 --- /dev/null +++ b/test/syntax/composite.go @@ -0,0 +1,11 @@ +// errorcheck + +// Copyright 2012 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 + +var a = []int{ + 3 // ERROR "need trailing comma before newline in composite literal" +}