d.LocalPkgName = n
p.next()
}
- if p.tok == _Literal && (gcCompat || p.kind == StringLit) {
+ if p.tok == _Literal && p.kind == StringLit {
d.Path = p.oliteral()
} else {
p.syntax_error("missing import path; require quoted string")
s := new(CallStmt)
s.init(p)
- s.Tok = p.tok
+ s.Tok = p.tok // _Defer or _Go
p.next()
x := p.pexpr(p.tok == _Lparen) // keep_parens so we can report error below
switch x := x.(type) {
case *CallExpr:
s.Call = x
- if gcCompat {
- s.node = x.node
- }
case *ParenExpr:
p.error(fmt.Sprintf("expression in %s must not be parenthesized", s.Tok))
// already progressed, no need to advance
break
}
}
- if gcCompat {
- typ.init(p)
- }
p.want(_Rbrace)
return typ
break
}
}
- if gcCompat {
- typ.init(p)
- }
p.want(_Rbrace)
return typ
return p.newAssignStmt(0, lhs, p.exprList())
case _Define:
- var n node
- n.init(p)
+ pos := p.pos()
p.next()
if rangeOk && p.got(_Range) {
}
as := p.newAssignStmt(Def, lhs, rhs)
- if gcCompat {
- as.node = n
- }
+ as.pos = pos // TODO(gri) pass this into newAssignStmt
return as
default:
p.advance(_Case, _Default, _Rbrace)
}
- if gcCompat {
- c.init(p)
- }
p.want(_Colon)
c.Body = p.stmtList()
{"testing.tRunner", 0},
}},
{trace.EvGoCreate, []frame{
- {"runtime/trace_test.TestTraceSymbolize", 39},
+ {"runtime/trace_test.TestTraceSymbolize", 37},
{"testing.tRunner", 0},
}},
{trace.EvGoStop, []frame{
package p
type T interface {
- M(interface {
+ M(interface { // ERROR "cannot export unnamed recursive interface"
T
- }) // ERROR "cannot export unnamed recursive interface"
+ })
}
// See golang.org/issue/9432.
package p
-type foo struct { // GCCGO_ERROR "invalid recursive type"
+type foo struct { // ERROR "invalid recursive type"
bar foo
blah foo
-} // ERROR "invalid recursive type foo"
+}
//import "greek/αβ"
// Import paths must be strings.
-import 42 // ERROR "import statement"
-import 'a' // ERROR "import statement"
-import 3.14 // ERROR "import statement"
-import 0.25i // ERROR "import statement"
-
-// Each of these pairs tests both `` vs "" strings
-// and also use of invalid characters spelled out as
-// escape sequences and written directly.
-// For example `"\x00"` tests import "\x00"
-// while "`\x00`" tests import `<actual-NUL-byte>`.
-import "" // ERROR "import path"
-import `` // ERROR "import path"
-import "\x00" // ERROR "import path"
-import `\x00` // ERROR "import path"
-import "\x7f" // ERROR "import path"
-import `\x7f` // ERROR "import path"
-import "a!" // ERROR "import path"
-import `a!` // ERROR "import path"
-import "a b" // ERROR "import path"
-import `a b` // ERROR "import path"
-import "a\\b" // ERROR "import path"
-import `a\\b` // ERROR "import path"
-import "\"`a`\"" // ERROR "import path"
-import `\"a\"` // ERROR "import path"
-import "\x80\x80" // ERROR "import path"
-import `\x80\x80` // ERROR "import path"
-import "\xFFFD" // ERROR "import path"
-import `\xFFFD` // ERROR "import path"
-
-// Invalid local imports.
-import "/foo" // ERROR "import path cannot be absolute path"
-import "c:/foo" // ERROR "import path contains invalid character"
+import 42 // ERROR "missing import path; require quoted string"
+import 'a' // ERROR "missing import path; require quoted string"
+import 3.14 // ERROR "missing import path; require quoted string"
+import 0.25i // ERROR "missing import path; require quoted string"
--- /dev/null
+// errorcheck
+
+// Copyright 2017 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.
+
+// Verify that invalid imports are rejected by the compiler.
+// Does not compile.
+
+package main
+
+// Each of these pairs tests both `` vs "" strings
+// and also use of invalid characters spelled out as
+// escape sequences and written directly.
+// For example `"\x00"` tests import "\x00"
+// while "`\x00`" tests import `<actual-NUL-byte>`.
+import "" // ERROR "import path"
+import `` // ERROR "import path"
+import "\x00" // ERROR "import path"
+import `\x00` // ERROR "import path"
+import "\x7f" // ERROR "import path"
+import `\x7f` // ERROR "import path"
+import "a!" // ERROR "import path"
+import `a!` // ERROR "import path"
+import "a b" // ERROR "import path"
+import `a b` // ERROR "import path"
+import "a\\b" // ERROR "import path"
+import `a\\b` // ERROR "import path"
+import "\"`a`\"" // ERROR "import path"
+import `\"a\"` // ERROR "import path"
+import "\x80\x80" // ERROR "import path"
+import `\x80\x80` // ERROR "import path"
+import "\xFFFD" // ERROR "import path"
+import `\xFFFD` // ERROR "import path"
+
+// Invalid local imports.
+import "/foo" // ERROR "import path cannot be absolute path"
+import "c:/foo" // ERROR "import path contains invalid character"
// In particular, at printint r must be live.
func f41(p, q *int) (r *int) { // ERROR "live at entry to f41: p q$"
r = p
- defer func() {
+ defer func() { // ERROR "live at call to deferproc: q r$" "live at call to deferreturn: r$"
recover()
- }() // ERROR "live at call to deferproc: q r$" "live at call to deferreturn: r$"
+ }()
printint(0) // ERROR "live at call to printint: q r$"
r = q
return // ERROR "live at call to deferreturn: r$"
case struct {
i int "tag2"
}:
- case struct {
+ case struct { // ERROR "duplicate case struct { i int .tag1. } in type switch"
i int "tag1"
- }: // ERROR "duplicate case struct { i int .tag1. } in type switch"
+ }:
}
}
w()
}:
return "rw"
- case interface { // GCCGO_ERROR "duplicate"
+ case interface { // ERROR "duplicate"
w()
r()
- }: // GC_ERROR "duplicate"
+ }:
return "wr"
}