var tok string
switch p.tok {
case _Name:
- tok = "`" + p.lit + "'"
+ tok = "name " + p.lit
case _Semi:
tok = p.lit
case _Literal:
// Line 9 must end in EOF for this test (no newline).
package e
-func([<-chan<-[func /* ERROR unexpected `u' */ u){go
\ No newline at end of file
+func([<-chan<-[func /* ERROR unexpected name u */ u){go
\ No newline at end of file
func _() {
_ = m[] // ERROR expected operand
_ = m[x,]
- _ = m[x /* ERROR unexpected `a' */ a b c d]
+ _ = m[x /* ERROR unexpected name a */ a b c d]
}
// test case from the issue
// test case from issue
type _ interface{
- m /* ERROR unexpected `int' in interface type; possibly missing semicolon or newline or } */ int
+ m /* ERROR unexpected name int in interface type; possibly missing semicolon or newline or } */ int
}
// other cases where the fix for this issue affects the error message
x int = 10 /* ERROR unexpected literal "foo" in grouped declaration; possibly missing semicolon or newline or \) */ "foo"
)
-var _ = []int{1, 2, 3 /* ERROR unexpected `int' in composite literal; possibly missing comma or } */ int }
+var _ = []int{1, 2, 3 /* ERROR unexpected name int in composite literal; possibly missing comma or } */ int }
type _ struct {
x y /* ERROR syntax error: unexpected comma in struct type; possibly missing semicolon or newline or } */ ,
}
-func f(a, b c /* ERROR unexpected `d' in parameter list; possibly missing comma or \) */ d) {
- f(a, b, c /* ERROR unexpected `d' in argument list; possibly missing comma or \) */ d)
+func f(a, b c /* ERROR unexpected name d in parameter list; possibly missing comma or \) */ d) {
+ f(a, b, c /* ERROR unexpected name d in argument list; possibly missing comma or \) */ d)
}
(int) | (string)
(int) | ~(string)
(/* ERROR unexpected ~ */ ~int)
- (int /* ERROR unexpected \| */ | /* ERROR unexpected `string' */ string /* ERROR unexpected \) */ )
+ (int /* ERROR unexpected \| */ | /* ERROR unexpected name string */ string /* ERROR unexpected \) */ )
}
)
func f() {
- int status // ERROR syntax error: unexpected `status' at end of statement
+ int status // ERROR syntax error: unexpected name status at end of statement
fmt.Println(status)
}
if hasDots(call) && id != _Append {
check.errorf(dddErrPos(call),
InvalidDotDotDot,
- invalidOp+"invalid use of ... with built-in %s", quote(bin.name))
+ invalidOp+"invalid use of ... with built-in %s", bin.name)
check.use(argList...)
return
}
if id == _Len {
code = InvalidLen
}
- check.errorf(x, code, invalidArg+"%s for %s", x, quote(bin.name))
+ check.errorf(x, code, invalidArg+"%s for built-in %s", x, bin.name)
}
return
}
case _Max, _Min:
// max(x, ...)
// min(x, ...)
- check.verifyVersionf(call.Fun, go1_21, "%s", quote(bin.name))
+ check.verifyVersionf(call.Fun, go1_21, "built-in %s", bin.name)
op := token.LSS
if id == _Max {
if x.mode != constant_ {
x.mode = value
// A value must not be untyped.
- check.assignment(x, &emptyInterface, "argument to "+quote(bin.name))
+ check.assignment(x, &emptyInterface, "argument to built-in "+bin.name)
if x.mode == invalid {
return
}
if nargs > 0 {
params = make([]Type, nargs)
for i, a := range args {
- check.assignment(a, nil, "argument to "+quote(predeclaredFuncs[id].name))
+ check.assignment(a, nil, "argument to built-in"+predeclaredFuncs[id].name)
if a.mode == invalid {
return
}
default:
panic("unreachable")
}
- check.softErrorf(x, code, "%s not supported as argument to %s for go1.18 (see go.dev/issue/50937)", x, quote(predeclaredFuncs[id].name))
+ check.softErrorf(x, code, "%s not supported as argument to built-in %s for go1.18 (see go.dev/issue/50937)", x, predeclaredFuncs[id].name)
// Construct a suitable new type parameter for the result type.
// The type parameter is placed in the current package so export/import
goto Error
}
if !exp.Exported() {
- check.errorf(e.Sel, UnexportedName, "%s not exported by package %s", quote(sel), quote(pkg.name))
+ check.errorf(e.Sel, UnexportedName, "name %s not exported by package %s", sel, pkg.name)
// ok to continue
}
}
check.files = append(check.files, file)
default:
- check.errorf(file, MismatchedPkgName, "package %s; expected %s", quote(name), quote(pkg.name))
+ check.errorf(file, MismatchedPkgName, "package %s; expected package %s", name, pkg.name)
// ignore this file
}
}
// For historical consistency, we report the primary error on the
// method, and the alt decl on the field.
err := check.newError(DuplicateFieldAndMethod)
- err.addf(alt, "field and method with the same name %s", quote(fld.name))
+ err.addf(alt, "field and method with the same name %s", fld.name)
err.addAltDecl(fld)
err.report()
}
"strings"
)
-// quote encloses s in `' quotes, as in `foo', except for _,
-// which is left alone.
-//
-// Use to prevent confusion when user supplied names alter the
-// meaning of an error message.
-//
-// For instance, report
-//
-// duplicate method `wanted'
-//
-// rather than
-//
-// duplicate method wanted
-//
-// Exceptions:
-//
-// - don't quote _:
-// `_' is ugly and not necessary
-// - don't quote after a ":" as there's no need for it:
-// undefined name: foo
-// - don't quote if the name is used correctly in a statement:
-// goto L jumps over variable declaration
-//
-// quote encloses s in `' quotes, as in `foo',
-// except for _ which is left alone.
-func quote(s string) string {
- if s == "_" {
- // `_' is ugly and not necessary
- return s
- }
- return "`" + s + "'"
-}
-
func sprintf(qf Qualifier, tpSubscripts bool, format string, args ...any) string {
for i, arg := range args {
switch a := arg.(type) {
conf := Config{Error: func(err error) { got += err.Error() + "\n" }}
typecheck(src, &conf, nil) // do not crash
want := "\n" +
- "p:1:27: `a' declared and not used\n" +
- "p:1:30: `b' declared and not used\n" +
- "p:1:33: `c' declared and not used\n" +
- "p:1:36: `d' declared and not used\n" +
- "p:1:39: `e' declared and not used\n"
+ "p:1:27: declared and not used: a\n" +
+ "p:1:30: declared and not used: b\n" +
+ "p:1:33: declared and not used: c\n" +
+ "p:1:36: declared and not used: d\n" +
+ "p:1:39: declared and not used: e\n"
if got != want {
t.Errorf("got: %swant: %s", got, want)
}
name := jmp.Label.Value
if alt := all.Lookup(name); alt != nil {
msg = "goto %s jumps into block"
- alt.(*Label).used = true // avoid another error
code = JumpIntoBlock
- // don't quote name here because "goto L" matches the code
+ alt.(*Label).used = true // avoid another error
} else {
msg = "label %s not declared"
code = UndeclaredLabel
- name = quote(name)
}
check.errorf(jmp.Label, code, msg, name)
}
for name, obj := range all.elems {
obj = resolve(name, obj)
if lbl := obj.(*Label); !lbl.used {
- check.softErrorf(lbl.pos, UnusedLabel, "label %s declared and not used", quote(lbl.name))
+ check.softErrorf(lbl.pos, UnusedLabel, "label %s declared and not used", lbl.name)
}
}
}
if alt := all.Insert(lbl); alt != nil {
err := check.newError(DuplicateLabel)
err.soft = true
- err.addf(lbl.pos, "label %s already declared", quote(name))
+ err.addf(lbl.pos, "label %s already declared", name)
err.addAltDecl(alt)
err.report()
// ok to continue
}
}
if !valid {
- check.errorf(s.Label, MisplacedLabel, "invalid break label %s", quote(name))
+ check.errorf(s.Label, MisplacedLabel, "invalid break label %s", name)
return
}
}
}
if !valid {
- check.errorf(s.Label, MisplacedLabel, "invalid continue label %s", quote(name))
+ check.errorf(s.Label, MisplacedLabel, "invalid continue label %s", name)
return
}
return cmpPos(unused[i].pos, unused[j].pos) < 0
})
for _, v := range unused {
- check.softErrorf(v.pos, UnusedVar, "%s declared and not used", quote(v.name))
+ check.softErrorf(v.pos, UnusedVar, "declared and not used: %s", v.name)
}
for _, scope := range scope.children {
for _, obj := range res.vars {
if alt := check.lookup(obj.name); alt != nil && alt != obj {
err := check.newError(OutOfScopeResult)
- err.addf(s, "result parameter %s not in scope at return", quote(obj.name))
+ err.addf(s, "result parameter %s not in scope at return", obj.name)
err.addf(alt, "inner declaration of %s", obj)
err.report()
// ok to continue
case explicit:
if check != nil {
err := check.newError(DuplicateDecl)
- err.addf(atPos(pos), "duplicate method %s", quote(m.name))
- err.addf(atPos(mpos[other.(*Func)]), "other declaration of %s", quote(m.name))
+ err.addf(atPos(pos), "duplicate method %s", m.name)
+ err.addf(atPos(mpos[other.(*Func)]), "other declaration of method %s", m.name)
err.report()
}
default:
check.later(func() {
if pos.IsKnown() && !check.allowVersion(atPos(pos), go1_14) || !Identical(m.typ, other.Type()) {
err := check.newError(DuplicateDecl)
- err.addf(atPos(pos), "duplicate method %s", quote(m.name))
- err.addf(atPos(mpos[other.(*Func)]), "other declaration of %s", quote(m.name))
+ err.addf(atPos(pos), "duplicate method %s", m.name)
+ err.addf(atPos(mpos[other.(*Func)]), "other declaration of method %s", m.name)
err.report()
}
}).describef(atPos(pos), "duplicate method check for %s", m.name)
switch obj := obj.(type) {
case *PkgName:
- check.errorf(e, InvalidPkgUse, "use of package %s not in selector", quote(obj.name))
+ check.errorf(e, InvalidPkgUse, "use of package %s not in selector", obj.name)
return
case *Const:
case *TypeName:
if !check.conf.EnableAlias && check.isBrokenAlias(obj) {
- check.errorf(e, InvalidDeclCycle, "invalid use of type alias %s in recursive type (see go.dev/issue/50729)", quote(obj.name))
+ check.errorf(e, InvalidDeclCycle, "invalid use of type alias %s in recursive type (see go.dev/issue/50729)", obj.name)
return
}
x.mode = typexpr
if hasDots(call) && id != _Append {
check.errorf(dddErrPos(call),
InvalidDotDotDot,
- invalidOp+"invalid use of ... with built-in %s", quote(bin.name))
+ invalidOp+"invalid use of ... with built-in %s", bin.name)
check.use(argList...)
return
}
if id == _Len {
code = InvalidLen
}
- check.errorf(x, code, invalidArg+"%s for %s", x, quote(bin.name))
+ check.errorf(x, code, invalidArg+"%s for built-in %s", x, bin.name)
}
return
}
case _Max, _Min:
// max(x, ...)
// min(x, ...)
- check.verifyVersionf(call.Fun, go1_21, "%s", quote(bin.name))
+ check.verifyVersionf(call.Fun, go1_21, "built-in %s", bin.name)
op := token.LSS
if id == _Max {
if x.mode != constant_ {
x.mode = value
// A value must not be untyped.
- check.assignment(x, &emptyInterface, "argument to "+quote(bin.name))
+ check.assignment(x, &emptyInterface, "argument to built-in "+bin.name)
if x.mode == invalid {
return
}
if nargs > 0 {
params = make([]Type, nargs)
for i, a := range args {
- check.assignment(a, nil, "argument to "+quote(predeclaredFuncs[id].name))
+ check.assignment(a, nil, "argument to built-in"+predeclaredFuncs[id].name)
if a.mode == invalid {
return
}
default:
panic("unreachable")
}
- check.softErrorf(x, code, "%s not supported as argument to %s for go1.18 (see go.dev/issue/50937)", x, quote(predeclaredFuncs[id].name))
+ check.softErrorf(x, code, "%s not supported as argument to built-in %s for go1.18 (see go.dev/issue/50937)", x, predeclaredFuncs[id].name)
// Construct a suitable new type parameter for the result type.
// The type parameter is placed in the current package so export/import
goto Error
}
if !exp.Exported() {
- check.errorf(e.Sel, UnexportedName, "%s not exported by package %s", quote(sel), quote(pkg.name))
+ check.errorf(e.Sel, UnexportedName, "name %s not exported by package %s", sel, pkg.name)
// ok to continue
}
}
check.files = append(check.files, file)
default:
- check.errorf(atPos(file.Package), MismatchedPkgName, "package %s; expected %s", quote(name), quote(pkg.name))
+ check.errorf(atPos(file.Package), MismatchedPkgName, "package %s; expected package %s", name, pkg.name)
// ignore this file
}
}
// For historical consistency, we report the primary error on the
// method, and the alt decl on the field.
err := check.newError(DuplicateFieldAndMethod)
- err.addf(alt, "field and method with the same name %s", quote(fld.name))
+ err.addf(alt, "field and method with the same name %s", fld.name)
err.addAltDecl(fld)
err.report()
}
"strings"
)
-// quote encloses s in `' quotes, as in `foo', except for _,
-// which is left alone.
-//
-// Use to prevent confusion when user supplied names alter the
-// meaning of an error message.
-//
-// For instance, report
-//
-// duplicate method `wanted'
-//
-// rather than
-//
-// duplicate method wanted
-//
-// Exceptions:
-//
-// - don't quote _:
-// `_' is ugly and not necessary
-// - don't quote after a ":" as there's no need for it:
-// undefined name: foo
-// - don't quote if the name is used correctly in a statement:
-// goto L jumps over variable declaration
-//
-// quote encloses s in `' quotes, as in `foo',
-// except for _ which is left alone.
-func quote(s string) string {
- if s == "_" {
- // `_' is ugly and not necessary
- return s
- }
- return "`" + s + "'"
-}
-
func sprintf(fset *token.FileSet, qf Qualifier, tpSubscripts bool, format string, args ...any) string {
for i, arg := range args {
switch a := arg.(type) {
conf := Config{Error: func(err error) { got += err.Error() + "\n" }}
typecheck(src, &conf, nil) // do not crash
want := "\n" +
- "p:1:27: `a' declared and not used\n" +
- "p:1:30: `b' declared and not used\n" +
- "p:1:33: `c' declared and not used\n" +
- "p:1:36: `d' declared and not used\n" +
- "p:1:39: `e' declared and not used\n"
+ "p:1:27: declared and not used: a\n" +
+ "p:1:30: declared and not used: b\n" +
+ "p:1:33: declared and not used: c\n" +
+ "p:1:36: declared and not used: d\n" +
+ "p:1:39: declared and not used: e\n"
if got != want {
t.Errorf("got: %swant: %s", got, want)
}
name := jmp.Label.Name
if alt := all.Lookup(name); alt != nil {
msg = "goto %s jumps into block"
- alt.(*Label).used = true // avoid another error
code = JumpIntoBlock
- // don't quote name here because "goto L" matches the code
+ alt.(*Label).used = true // avoid another error
} else {
msg = "label %s not declared"
code = UndeclaredLabel
- name = quote(name)
}
check.errorf(jmp.Label, code, msg, name)
}
for name, obj := range all.elems {
obj = resolve(name, obj)
if lbl := obj.(*Label); !lbl.used {
- check.softErrorf(lbl, UnusedLabel, "label %s declared and not used", quote(lbl.name))
+ check.softErrorf(lbl, UnusedLabel, "label %s declared and not used", lbl.name)
}
}
}
if alt := all.Insert(lbl); alt != nil {
err := check.newError(DuplicateLabel)
err.soft = true
- err.addf(lbl, "label %s already declared", quote(name))
+ err.addf(lbl, "label %s already declared", name)
err.addAltDecl(alt)
err.report()
// ok to continue
}
}
if !valid {
- check.errorf(s.Label, MisplacedLabel, "invalid break label %s", quote(name))
+ check.errorf(s.Label, MisplacedLabel, "invalid break label %s", name)
return
}
}
}
if !valid {
- check.errorf(s.Label, MisplacedLabel, "invalid continue label %s", quote(name))
+ check.errorf(s.Label, MisplacedLabel, "invalid continue label %s", name)
return
}
return cmpPos(unused[i].pos, unused[j].pos) < 0
})
for _, v := range unused {
- check.softErrorf(v, UnusedVar, "%s declared and not used", quote(v.name))
+ check.softErrorf(v, UnusedVar, "declared and not used: %s", v.name)
}
for _, scope := range scope.children {
for _, obj := range res.vars {
if alt := check.lookup(obj.name); alt != nil && alt != obj {
err := check.newError(OutOfScopeResult)
- err.addf(s, "result parameter %s not in scope at return", quote(obj.name))
+ err.addf(s, "result parameter %s not in scope at return", obj.name)
err.addf(alt, "inner declaration of %s", obj)
err.report()
// ok to continue
case explicit:
if check != nil {
err := check.newError(DuplicateDecl)
- err.addf(atPos(pos), "duplicate method %s", quote(m.name))
- err.addf(atPos(mpos[other.(*Func)]), "other declaration of %s", quote(m.name))
+ err.addf(atPos(pos), "duplicate method %s", m.name)
+ err.addf(atPos(mpos[other.(*Func)]), "other declaration of method %s", m.name)
err.report()
}
default:
check.later(func() {
if pos.IsValid() && !check.allowVersion(atPos(pos), go1_14) || !Identical(m.typ, other.Type()) {
err := check.newError(DuplicateDecl)
- err.addf(atPos(pos), "duplicate method %s", quote(m.name))
- err.addf(atPos(mpos[other.(*Func)]), "other declaration of %s", quote(m.name))
+ err.addf(atPos(pos), "duplicate method %s", m.name)
+ err.addf(atPos(mpos[other.(*Func)]), "other declaration of method %s", m.name)
err.report()
}
}).describef(atPos(pos), "duplicate method check for %s", m.name)
switch obj := obj.(type) {
case *PkgName:
- check.errorf(e, InvalidPkgUse, "use of package %s not in selector", quote(obj.name))
+ check.errorf(e, InvalidPkgUse, "use of package %s not in selector", obj.name)
return
case *Const:
case *TypeName:
if !check.conf._EnableAlias && check.isBrokenAlias(obj) {
- check.errorf(e, InvalidDeclCycle, "invalid use of type alias %s in recursive type (see go.dev/issue/50729)", quote(obj.name))
+ check.errorf(e, InvalidDeclCycle, "invalid use of type alias %s in recursive type (see go.dev/issue/50729)", obj.name)
return
}
x.mode = typexpr
var s [][]byte
_ = cap(s)
- _ = cap(s... /* ERROR "invalid use of ... with built-in `cap'" */ )
+ _ = cap(s... /* ERROR "invalid use of ... with built-in cap" */ )
var x int
- _ = cap(x /* ERROR "invalid argument: x (variable of type int) for `cap'" */ )
+ _ = cap(x /* ERROR "invalid argument: x (variable of type int) for built-in cap" */ )
}
func cap2() {
}
I3 interface {
m1()
- m1 /* ERROR "duplicate method `m1'" */ ()
+ m1 /* ERROR "duplicate method m1" */ ()
}
I4 interface {
m1(x, y, x /* ERROR "redeclared" */ float32)
func (T1) m() {}
func (T1) m /* ERROR "already declared" */ () {}
-func (x *T1) f /* ERROR "field and method with the same name `f'" */ () {}
+func (x *T1) f /* ERROR "field and method with the same name f" */ () {}
// Conflict between embedded field and method name,
// with the embedded field being a basic type.
time.Time
}
-func (T1c) Time /* ERROR "field and method with the same name `Time'" */ () int { return 0 }
+func (T1c) Time /* ERROR "field and method with the same name Time" */ () int { return 0 }
// Disabled for now: LookupFieldOrMethod will find Pointer even though
// it's double-declared (it would cost extra in the common case to verify
type _ interface {
m()
- I // ERROR "duplicate method `m'"
+ I // ERROR "duplicate method m"
}
type _ interface {
I
- I // ERROR "duplicate method `m'"
+ I // ERROR "duplicate method m"
}
// reflect.flag must not be visible in this package
type flag int
-type _ reflect.flag /* ERROR "`flag' not exported by package `reflect'" */
+type _ reflect.flag /* ERROR "name flag not exported by package reflect" */
// imported package name may conflict with local objects
type reflect /* ERROR "reflect already declared" */ int
var x int
func f0() {
-L1 /* ERROR "label `L1' declared and not used" */ :
+L1 /* ERROR "label L1 declared and not used" */ :
for {
}
-L2 /* ERROR "label `L2' declared and not used" */ :
+L2 /* ERROR "label L2 declared and not used" */ :
select {
}
-L3 /* ERROR "label `L3' declared and not used" */ :
+L3 /* ERROR "label L3 declared and not used" */ :
switch {
}
-L4 /* ERROR "label `L4' declared and not used" */ :
+L4 /* ERROR "label L4 declared and not used" */ :
if true {
}
-L5 /* ERROR "label `L5' declared and not used" */ :
+L5 /* ERROR "label L5 declared and not used" */ :
f0()
L6:
f0()
-L6 /* ERROR "label `L6' already declared" */ :
+L6 /* ERROR "label L6 already declared" */ :
f0()
if x == 20 {
goto L6
L7:
for {
break L7
- break L8 /* ERROR "invalid break label `L8'" */
+ break L8 /* ERROR "invalid break label L8" */
}
// A label must be directly associated with a switch, select, or
L7a /* ERROR "declared and not used" */ : L7b:
for {
- break L7a /* ERROR "invalid break label `L7a'" */
- continue L7a /* ERROR "invalid continue label `L7a'" */
+ break L7a /* ERROR "invalid break label L7a" */
+ continue L7a /* ERROR "invalid continue label L7a" */
continue L7b
}
for {
if x == 21 {
continue L8
- continue L7 /* ERROR "invalid continue label `L7'" */
+ continue L7 /* ERROR "invalid continue label L7" */
}
}
switch {
case true:
break L9
- defalt /* ERROR "label `defalt' declared and not used" */ :
+ defalt /* ERROR "label defalt declared and not used" */ :
}
L10:
select {
default:
break L10
- break L9 /* ERROR "invalid break label `L9'" */
+ break L9 /* ERROR "invalid break label L9" */
}
goto L10a
L10a: L10b:
select {
default:
- break L10a /* ERROR "invalid break label `L10a'" */
+ break L10a /* ERROR "invalid break label L10a" */
break L10b
- continue L10b /* ERROR "invalid continue label `L10b'" */
+ continue L10b /* ERROR "invalid continue label L10b" */
}
}
break L2
}
if x == 1 {
- continue L2 /* ERROR "invalid continue label `L2'" */
+ continue L2 /* ERROR "invalid continue label L2" */
}
goto L2
}
break L3
}
if x == 12 {
- continue L3 /* ERROR "invalid continue label `L3'" */
+ continue L3 /* ERROR "invalid continue label L3" */
}
goto L3
}
L4:
if true {
if x == 13 {
- break L4 /* ERROR "invalid break label `L4'" */
+ break L4 /* ERROR "invalid break label L4" */
}
if x == 14 {
- continue L4 /* ERROR "invalid continue label `L4'" */
+ continue L4 /* ERROR "invalid continue label L4" */
}
if x == 15 {
goto L4
L5:
f1()
if x == 16 {
- break L5 /* ERROR "invalid break label `L5'" */
+ break L5 /* ERROR "invalid break label L5" */
}
if x == 17 {
- continue L5 /* ERROR "invalid continue label `L5'" */
+ continue L5 /* ERROR "invalid continue label L5" */
}
if x == 18 {
goto L5
for {
if x == 19 {
- break L1 /* ERROR "invalid break label `L1'" */
+ break L1 /* ERROR "invalid break label L1" */
}
if x == 20 {
- continue L1 /* ERROR "invalid continue label `L1'" */
+ continue L1 /* ERROR "invalid continue label L1" */
}
if x == 21 {
goto L1
// Additional tests not in the original files.
func f2() {
-L1 /* ERROR "label `L1' declared and not used" */ :
+L1 /* ERROR "label L1 declared and not used" */ :
if x == 0 {
for {
- continue L1 /* ERROR "invalid continue label `L1'" */
+ continue L1 /* ERROR "invalid continue label L1" */
}
}
}
L2:
L3:
for {
- break L1 /* ERROR "invalid break label `L1'" */
- break L2 /* ERROR "invalid break label `L2'" */
+ break L1 /* ERROR "invalid break label L1" */
+ break L2 /* ERROR "invalid break label L2" */
break L3
- continue L1 /* ERROR "invalid continue label `L1'" */
- continue L2 /* ERROR "invalid continue label `L2'" */
+ continue L1 /* ERROR "invalid continue label L1" */
+ continue L2 /* ERROR "invalid continue label L2" */
continue L3
goto L1
goto L2
ch2 := make(chan int)
select {
case <-ch1:
- var ch2 /* ERROR "`ch2' declared and not used" */ chan bool
+ var ch2 /* ERROR "declared and not used: ch2" */ chan bool
case i := <-ch2:
print(i + 1)
}
{
type a int
return 1, 2
- return /* ERROR "`a' not in scope at return" */
+ return /* ERROR "result parameter a not in scope at return" */
}
}
type SR = R[SS, ST]
type SS interface {
- NSR(any) *SR // ERROR "invalid use of type alias `SR' in recursive type"
+ NSR(any) *SR // ERROR "invalid use of type alias SR in recursive type"
}
type C interface {
type _ interface {
Reader
- Reader // ERROR "duplicate method `Read'"
+ Reader // ERROR "duplicate method Read"
}
type Reader interface {
type _ interface {
io.Reader
- Reader // ERROR "duplicate method `Read'"
+ Reader // ERROR "duplicate method Read"
}
type _ interface {
io.Reader
- io /* ERROR "duplicate method `Read'" */ .Reader
+ io /* ERROR "duplicate method Read" */ .Reader
}
import "fmt" // GC_ERROR "imported and not used"
-const n = fmt // ERROR "fmt without selector|unexpected reference to package|use of package `fmt' not in selector"
+const n = fmt // ERROR "fmt without selector|unexpected reference to package|use of package fmt not in selector"
// there yet, so put it here for now. See also #20800.)
package e
-func([<-chan<-[func u){go // ERROR "unexpected `u'"
\ No newline at end of file
+func([<-chan<-[func u){go // ERROR "unexpected name u"
\ No newline at end of file
log.Fatalf("expected cmd/compile to fail")
}
wantErrs := []string{
- "7:9: `n' declared and not used",
- "7:12: `err' declared and not used",
+ "7:9: declared and not used: n",
+ "7:12: declared and not used: err",
}
outStr := string(out)
for _, want := range wantErrs {
package p
func f() {
- if f() true { // ERROR "unexpected `true', expected {"
+ if f() true { // ERROR "unexpected name true, expected {"
}
-
- switch f() true { // ERROR "unexpected `true', expected {"
+
+ switch f() true { // ERROR "unexpected name true, expected {"
}
}
type E struct{}
-func (T) b() {} // ERROR "field and method named b|redeclares struct field name|field and method with the same name `b'"
-func (*T) E() {} // ERROR "field and method named E|redeclares struct field name|field and method with the same name `E'"
+func (T) b() {} // ERROR "field and method named b|redeclares struct field name|field and method with the same name b"
+func (*T) E() {} // ERROR "field and method named E|redeclares struct field name|field and method with the same name E"
func _() {
var x T
package main
func _() {
- x := 7 // ERROR ".*x.* declared and not used"
+ x := 7 // ERROR "declared and not used"
}
package p
-type I interface { M() }
+type I interface{ M() }
type _ interface {
I
- I // ERROR "duplicate method `M'"
+ I // ERROR "duplicate method M"
}