]> Cypherpunks repositories - gostls13.git/commitdiff
gc: more syntax errors
authorRuss Cox <rsc@golang.org>
Thu, 25 Mar 2010 19:47:43 +0000 (12:47 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 25 Mar 2010 19:47:43 +0000 (12:47 -0700)
R=r
CC=golang-dev
https://golang.org/cl/731041

src/cmd/gc/go.errors
test/syntax/vareq.go [new file with mode: 0644]
test/syntax/vareq1.go [new file with mode: 0644]

index 3cb718adb130d2cb9e46d3bea48a18f0b6dac460..ddd4a6222694fc8be7919a04a1f27c1276a434b0 100644 (file)
@@ -13,34 +13,40 @@ static struct {
        // Each line of the form % token list
        // is converted by bisonerrors into the yystate and yychar caused
        // by that token list.
-       
+
        % loadsys package LIMPORT '(' LLITERAL import_package import_there ','
        "unexpected comma during import block",
-       
+
        % loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header ';'
        "unexpected semicolon or newline before {",
-       
+
        % loadsys package imports LFUNC LNAME '(' ')' '{' LSWITCH if_header ';'
        "unexpected semicolon or newline before {",
-       
+
        % loadsys package imports LFUNC LNAME '(' ')' '{' LFOR for_header ';'
        "unexpected semicolon or newline before {",
-       
+
        % loadsys package imports LFUNC LNAME '(' ')' '{' LFOR ';' LBODY
        "unexpected semicolon or newline before {",
-       
+
        % loadsys package imports LFUNC LNAME '(' ')' ';' '{'
        "unexpected semicolon or newline before {",
-       
+
        % loadsys package imports LTYPE LNAME ';'
        "unexpected semicolon or newline in type declaration",
-       
+
        % loadsys package imports LFUNC LNAME '(' ')' '{' if_stmt ';' LELSE
        "unexpected semicolon or newline before else",
-       
+
        % loadsys package imports LTYPE LNAME LINTERFACE '{' LNAME ',' LNAME
        "name list not allowed in interface type",
-       
+
        % loadsys package imports LFUNC LNAME '(' ')' '{' LFOR LVAR LNAME '=' LNAME
        "var declaration not allowed in for initializer",
+
+       % loadsys package imports LVAR LNAME '[' ']' LNAME '{'
+       "var declaration missing = before initial value",
+
+       % loadsys package imports LFUNC LNAME '(' ')' '{' LVAR LNAME '[' ']' LNAME '{'
+       "var declaration missing = before initial value",
 };
diff --git a/test/syntax/vareq.go b/test/syntax/vareq.go
new file mode 100644 (file)
index 0000000..ef15fe5
--- /dev/null
@@ -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() {
+       var x map[string]string{"a":"b"}                // ERROR "var declaration missing ="
diff --git a/test/syntax/vareq1.go b/test/syntax/vareq1.go
new file mode 100644 (file)
index 0000000..4697d01
--- /dev/null
@@ -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
+
+var x map[string]string{"a":"b"}               // ERROR "var declaration missing ="
+