1
0
mirror of https://github.com/golang/go synced 2024-11-21 12:34:38 -07:00

gc: improve error message for composite literals with unexpected newlines

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5857045
This commit is contained in:
Ryan Hitchman 2012-04-02 11:00:55 -04:00 committed by Russ Cox
parent a9de5bb3eb
commit 8a686792e0
3 changed files with 17 additions and 0 deletions

View File

@ -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",

View File

@ -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",

11
test/syntax/composite.go Normal file
View File

@ -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"
}