]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: enable new parser by default
authorMatthew Dempsky <mdempsky@google.com>
Tue, 16 Aug 2016 23:33:05 +0000 (16:33 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 25 Oct 2016 22:28:40 +0000 (22:28 +0000)
Change-Id: I3c784986755cfbbe1b8eb8da4d64227bd109a3b0
Reviewed-on: https://go-review.googlesource.com/27203
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/noder.go
src/go/types/stdlib_test.go
test/alias2.go
test/fixedbugs/issue11610.go
test/nul1.go
test/syntax/chan1.go
test/syntax/semi4.go

index 3803417cea977d0b069b82899b0b8d1a9334588f..db7c76231a273233cb0a4efc7136f7a6159438fe 100644 (file)
@@ -181,7 +181,7 @@ func Main() {
        obj.Flagcount("live", "debug liveness analysis", &debuglive)
        obj.Flagcount("m", "print optimization decisions", &Debug['m'])
        flag.BoolVar(&flag_msan, "msan", false, "build code compatible with C/C++ memory sanitizer")
-       flag.BoolVar(&flag_newparser, "newparser", false, "use new parser")
+       flag.BoolVar(&flag_newparser, "newparser", true, "use new parser")
        flag.BoolVar(&nolocalimports, "nolocalimports", false, "reject local (relative) imports")
        flag.StringVar(&outfile, "o", "", "write output to `file`")
        flag.StringVar(&myimportpath, "p", "", "set expected package import `path`")
index 6dc082410fbf61006ab3398ecead69baf510a7fc..3cfd1cad20aa9d8aa36c540dbd37e81de1724cc7 100644 (file)
@@ -578,6 +578,7 @@ func (p *noder) structType(expr *syntax.StructType) *Node {
                l = append(l, n)
        }
 
+       p.lineno(expr)
        n := p.nod(expr, OTSTRUCT, nil, nil)
        n.List.Set(l)
        return n
index 0fdd495735dfb355362f71277021d2b286fe7401..4192a3608ebf126b668dd1a5540c7e63ab1a131c 100644 (file)
@@ -100,9 +100,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
                        switch cmd {
                        case "skip", "compiledir":
                                continue // ignore this file
-                       // TODO(mdempsky): Remove -newparser=0 case once
-                       // test/fixedbugs/issue11610.go is updated.
-                       case "errorcheck", "errorcheck -newparser=0":
+                       case "errorcheck":
                                expectErrors = true
                        }
                }
index b73f81c014f7159815d1c875e66c9f5113a5f601..a09f524611fda6da82645b8e829eda7cf76714c4 100644 (file)
@@ -1,4 +1,4 @@
-// errorcheck -newparser=1
+// errorcheck
 
 // Copyright 2016 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index cb5ced6d7c857424f01dc7b794c68f99c99842e3..5e77932362dcd4e2779a5afac6efcd77a8f4a743 100644 (file)
@@ -1,4 +1,4 @@
-// errorcheck -newparser=0
+// errorcheck
 
 // Copyright 2015 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -7,15 +7,11 @@
 // Test an internal compiler error on ? symbol in declaration
 // following an empty import.
 
-// TODO(mdempsky): Update for new parser. New parser recovers more
-// gracefully and doesn't trigger the "cannot declare name" error.
-// Also remove "errorcheck -newparser=0" case in go/types.TestStdFixed.
-
 package a
 import""  // ERROR "import path is empty"
 var?      // ERROR "illegal character U\+003F '\?'"
 
-var x int // ERROR "unexpected var" "cannot declare name"
+var x int // ERROR "unexpected var"
 
 func main() {
 }
index 624101b621fac42ac4ba5a78ad1207c01cef1e52..fbba19857b9cee4f01fe694b20b01e68222dfbd7 100644 (file)
@@ -1,4 +1,4 @@
-// errorcheckoutput -newparser=0
+// errorcheckoutput
 
 // Copyright 2009 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -6,10 +6,6 @@
 
 // Test source files and strings containing NUL and invalid UTF-8.
 
-// TODO(mdempsky): Update error expectations for -newparser=1. The new
-// lexer skips over NUL and invalid UTF-8 sequences, so they don't emit
-// "illegal character" or "invalid identifier character" errors.
-
 package main
 
 import (
@@ -40,7 +36,7 @@ var y = ` + "`in raw string \x00 foo`" + `  // ERROR "NUL"
 
 /* in other comment ` + "\x00" + ` */ // ERROR "NUL"
 
-/* in source code */ ` + "\x00" + `// ERROR "NUL" "illegal character"
+/* in source code */ ` + "\x00" + `// ERROR "NUL"
 
 var xx = "in string ` + "\xc2\xff" + `" // ERROR "UTF-8"
 
@@ -51,9 +47,9 @@ var yy = ` + "`in raw string \xff foo`" + `  // ERROR "UTF-8"
 /* in other comment ` + "\xe0\x00\x00" + ` */ // ERROR "UTF-8|NUL"
 
 /* in variable name */
-var z` + "\xc1\x81" + ` int // ERROR "UTF-8" "invalid identifier character"
+var z` + "\xc1\x81" + ` int // ERROR "UTF-8"
 
-/* in source code */ ` + "var \xc2A int" + `// ERROR "UTF-8" "invalid identifier character"
+/* in source code */ ` + "var \xc2A int" + `// ERROR "UTF-8"
 
 `)
 }
index 22724fd297744f21d184157e4ae3a4851729c979..a33a0d4cea2791ab5e5b09200f7636b9ea82de17 100644 (file)
@@ -1,21 +1,17 @@
-// errorcheck -newparser=0
+// errorcheck
 
 // 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.
 
-// TODO(mdempsky): Update for new parser or delete.
-// Like go/parser, the new parser doesn't specially recognize
-// send statements misused in an expression context.
-
 package main
 
 var c chan int
 var v int
 
 func main() {
-       if c <- v { // ERROR "used as value"
+       if c <- v { // ERROR "used as value|missing condition|invalid condition"
        }
 }
 
-var _ = c <- v // ERROR "used as value"
+var _ = c <- v // ERROR "used as value|unexpected <-"
index 262926a01e3d53c104be604154850d7d8809750d..6f5592ef0ebf3a4ef38ee0de60539e10ef352382 100644 (file)
@@ -1,4 +1,4 @@
-// errorcheck -newparser=0
+// errorcheck
 
 // Copyright 2010 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -14,4 +14,4 @@ package main
 func main() {
        for x           // GCCGO_ERROR "undefined"
        {               // ERROR "missing .*{.* after for clause|missing operand"
-               z       // GCCGO_ERROR "undefined"
+               z       // ERROR "undefined|missing { after for clause"