// A new knownFormats table based on the found formats is printed
// when the test is run in verbose mode (-v flag). The table
// needs to be updated whenever a new (type, format) combination
-// is found and the format verb is not 'v' (as in "%v").
+// is found and the format verb is not 'v' or 'T' (as in "%v" or
+// "%T").
//
// Run as: go test -run Formats [-u][-v]
//
}
// report an error if the format is unknown and this is the first
- // time we see it; ignore "%v" which is always considered valid
- if !known && !found && in != "%v" {
+ // time we see it; ignore "%v" and "%T" which are always valid
+ if !known && !found && in != "%v" && in != "%T" {
t.Errorf("%s: unknown format %q for %s argument", posString(p.arg), in, typ)
}
"*cmd/compile/internal/gc.Mpflt %v": "",
"*cmd/compile/internal/gc.Mpint %v": "",
"*cmd/compile/internal/gc.Node %#v": "",
- "*cmd/compile/internal/gc.Node %+1v": "",
+ "*cmd/compile/internal/gc.Node %+S": "",
"*cmd/compile/internal/gc.Node %+v": "",
"*cmd/compile/internal/gc.Node %0j": "",
- "*cmd/compile/internal/gc.Node %1v": "",
- "*cmd/compile/internal/gc.Node %2v": "",
+ "*cmd/compile/internal/gc.Node %L": "",
+ "*cmd/compile/internal/gc.Node %S": "",
"*cmd/compile/internal/gc.Node %j": "",
"*cmd/compile/internal/gc.Node %p": "",
- "*cmd/compile/internal/gc.Node %s": "",
"*cmd/compile/internal/gc.Node %v": "",
"*cmd/compile/internal/gc.Sym % v": "",
"*cmd/compile/internal/gc.Sym %+v": "",
"*cmd/compile/internal/gc.Sym %-v": "",
- "*cmd/compile/internal/gc.Sym %01v": "",
- "*cmd/compile/internal/gc.Sym %1v": "",
+ "*cmd/compile/internal/gc.Sym %0S": "",
+ "*cmd/compile/internal/gc.Sym %S": "",
"*cmd/compile/internal/gc.Sym %p": "",
- "*cmd/compile/internal/gc.Sym %s": "",
"*cmd/compile/internal/gc.Sym %v": "",
"*cmd/compile/internal/gc.Type % -v": "",
"*cmd/compile/internal/gc.Type %#v": "",
"*cmd/compile/internal/gc.Type %+v": "",
"*cmd/compile/internal/gc.Type %- v": "",
- "*cmd/compile/internal/gc.Type %-1v": "",
+ "*cmd/compile/internal/gc.Type %-S": "",
"*cmd/compile/internal/gc.Type %-v": "",
- "*cmd/compile/internal/gc.Type %01v": "",
- "*cmd/compile/internal/gc.Type %1v": "",
- "*cmd/compile/internal/gc.Type %2v": "",
+ "*cmd/compile/internal/gc.Type %0S": "",
+ "*cmd/compile/internal/gc.Type %L": "",
+ "*cmd/compile/internal/gc.Type %S": "",
"*cmd/compile/internal/gc.Type %p": "",
- "*cmd/compile/internal/gc.Type %s": "",
"*cmd/compile/internal/gc.Type %v": "",
"*cmd/compile/internal/ssa.Block %s": "",
"*cmd/compile/internal/ssa.Block %v": "",
"cmd/compile/internal/gc.Level %d": "",
"cmd/compile/internal/gc.Level %v": "",
"cmd/compile/internal/gc.Node %#v": "",
- "cmd/compile/internal/gc.Nodes %#s": "",
"cmd/compile/internal/gc.Nodes %#v": "",
"cmd/compile/internal/gc.Nodes %+v": "",
"cmd/compile/internal/gc.Nodes %.v": "",
"cmd/compile/internal/gc.Nodes %v": "",
"cmd/compile/internal/gc.Op %#v": "",
- "cmd/compile/internal/gc.Op %d": "",
- "cmd/compile/internal/gc.Op %s": "",
"cmd/compile/internal/gc.Op %v": "",
"cmd/compile/internal/gc.Val %#v": "",
- "cmd/compile/internal/gc.Val %s": "",
+ "cmd/compile/internal/gc.Val %T": "",
"cmd/compile/internal/gc.Val %v": "",
"cmd/compile/internal/gc.initKind %d": "",
"cmd/compile/internal/ssa.BlockKind %s": "",
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %L has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %2v -> %2v\n", f, t)
+ fmt.Printf("gmove %L -> %L\n", f, t)
}
ft := gc.Simsimtype(f.Type)
default:
gc.Dump("f", f)
gc.Dump("t", t)
- gc.Fatalf("gmove %2v -> %2v", f.Type, t.Type)
+ gc.Fatalf("gmove %L -> %L", f.Type, t.Type)
/*
* integer copy and truncate
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %L has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthptr) {
// merge with range we already have
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %L has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %2v -> %2v\n", f, t)
+ fmt.Printf("gmove %L -> %L\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
switch uint32(ft)<<16 | uint32(tt) {
default:
- gc.Fatalf("gmove %2v -> %2v", f.Type, t.Type)
+ gc.Fatalf("gmove %L -> %L", f.Type, t.Type)
/*
* integer copy and truncate
}
o += w
if o >= Thearch.MAXWIDTH {
- Yyerror("type %2v too large", errtype)
+ Yyerror("type %L too large", errtype)
o = 8 // small but nonzero
}
}
if t.Elem().Width != 0 {
cap := (uint64(Thearch.MAXWIDTH) - 1) / uint64(t.Elem().Width)
if uint64(t.NumElem()) > cap {
- Yyerror("type %2v larger than address space", t)
+ Yyerror("type %L larger than address space", t)
}
}
w = t.NumElem() * t.Elem().Width
// function has inlineable body:
// write index and body
if p.trace {
- p.tracef("\n----\nfunc { %#s }\n", f.Inl)
+ p.tracef("\n----\nfunc { %#v }\n", f.Inl)
}
p.int(i)
p.stmtList(f.Inl)
p.typ(t.Elem())
default:
- Fatalf("exporter: unexpected type: %s (Etype = %d)", t, t.Etype)
+ Fatalf("exporter: unexpected type: %v (Etype = %d)", t, t.Etype)
}
}
p.op(ODCLCONST)
default:
- Fatalf("cannot export %s (%d) node\n"+
- "==> please file an issue and assign to gri@\n", n.Op, n.Op)
+ Fatalf("cannot export %v (%d) node\n"+
+ "==> please file an issue and assign to gri@\n", n.Op, int(n.Op))
}
}
p.expr(n.Left)
default:
- Fatalf("exporter: CANNOT EXPORT: %s\nPlease notify gri@\n", n.Op)
+ Fatalf("exporter: CANNOT EXPORT: %v\nPlease notify gri@\n", n.Op)
}
}
func (p *exporter) op(op Op) {
if p.trace {
p.tracef("[")
- defer p.tracef("= %s] ", op)
+ defer p.tracef("= %v] ", op)
}
p.int(int(op))
pt := pair.pt
t := pair.t
if !Eqtype(pt.Orig, t) {
- formatErrorf("inconsistent definition for type %v during import\n\t%2v (in %q)\n\t%2v (in %q)", pt.Sym, pt, pt.Sym.Importdef.Path, t, importpkg.Path)
+ formatErrorf("inconsistent definition for type %v during import\n\t%L (in %q)\n\t%L (in %q)", pt.Sym, pt, pt.Sym.Importdef.Path, t, importpkg.Path)
}
}
}
}
if Debug['E'] != 0 {
- fmt.Printf("import type %v %2v\n", pt, t)
+ fmt.Printf("import type %v %L\n", pt, t)
}
}
return nil
default:
- Fatalf("cannot import %s (%d) node\n"+
- "==> please file an issue and assign to gri@\n", op, op)
+ Fatalf("cannot import %v (%d) node\n"+
+ "==> please file an issue and assign to gri@\n", op, int(op))
panic("unreachable") // satisfy compiler
}
}
default:
Dump("cgen", n)
Dump("cgen-res", res)
- Fatalf("cgen: unknown op %+1v", n)
+ Fatalf("cgen: unknown op %+S", n)
case OOROR, OANDAND,
OEQ, ONE,
break
}
- Fatalf("cgen: OLEN: unknown type %2v", nl.Type)
+ Fatalf("cgen: OLEN: unknown type %L", nl.Type)
case OCAP:
if nl.Type.IsChan() {
break
}
- Fatalf("cgen: OCAP: unknown type %2v", nl.Type)
+ Fatalf("cgen: OCAP: unknown type %L", nl.Type)
case OADDR:
if n.Bounded { // let race detector avoid nil checks
switch n.Op {
default:
Dump("bad agen", n)
- Fatalf("agen: unknown op %+1v", n)
+ Fatalf("agen: unknown op %+S", n)
case OCALLMETH:
cgen_callmeth(n, 0)
case OLITERAL:
// n is a constant.
if !Isconst(n, CTBOOL) {
- Fatalf("bgen: non-bool const %2v\n", n)
+ Fatalf("bgen: non-bool const %L\n", n)
}
if genval {
Cgen(Nodbool(wantTrue == n.Val().U.(bool)), res)
if !n.Name.Captured {
n.Name.Captured = true
if n.Name.Decldepth == 0 {
- Fatalf("typecheckclosure: var %1v does not have decldepth assigned", n)
+ Fatalf("typecheckclosure: var %S does not have decldepth assigned", n)
}
// Ignore assignments to the variable in straightline code
n.Func.Outerfunc.Func.Closgen++
gen = n.Func.Outerfunc.Func.Closgen
default:
- Fatalf("closurename called for %1v", n)
+ Fatalf("closurename called for %S", n)
}
n.Sym = Lookupf("%s.%s%d", outer, prefix, gen)
return n.Sym
rcvrtype := fn.Left.Type
if exportname(meth.Name) {
- p = fmt.Sprintf("(%-1v).%s-fm", rcvrtype, meth.Name)
+ p = fmt.Sprintf("(%-S).%s-fm", rcvrtype, meth.Name)
} else {
- p = fmt.Sprintf("(%-1v).(%-v)-fm", rcvrtype, meth)
+ p = fmt.Sprintf("(%-S).(%-v)-fm", rcvrtype, meth)
}
basetype := rcvrtype
if rcvrtype.IsPtr() {
}
if doesoverflow(v, t) {
- Yyerror("constant %s overflows %v", v, t)
+ Yyerror("constant %v overflows %v", v, t)
}
}
var i int64
switch n.Val().Ctype() {
default:
- Fatalf("convconst ctype=%d %2v", n.Val().Ctype(), t)
+ Fatalf("convconst ctype=%d %L", n.Val().Ctype(), t)
case CTINT, CTRUNE:
i = n.Int64()
return
}
- Fatalf("convconst %2v constant", t)
+ Fatalf("convconst %L constant", t)
}
// complex multiply v *= rv
tmp = s.Pkg.Path
}
pkgstr := tmp
- Yyerror("%v redeclared %s\n"+"\tprevious declaration during import %q", s, where, pkgstr)
+ Yyerror("%v redeclared %s\n"+
+ "\tprevious declaration during import %q", s, where, pkgstr)
} else {
line1 := lineno
line2 := s.Lastlineno
line1 = s.Lastlineno
}
- yyerrorl(line1, "%v redeclared %s\n"+"\tprevious declaration at %v", s, where, linestr(line2))
+ yyerrorl(line1, "%v redeclared %s\n"+
+ "\tprevious declaration at %v", s, where, linestr(line2))
}
}
if (spkg == nil || nsym.Pkg != spkg) && !exportname(nsym.Name) {
if t0.Sym == nil && t0.IsPtr() {
- p = fmt.Sprintf("(%-1v).%s.%s%s", t0, nsym.Pkg.Prefix, nsym.Name, suffix)
+ p = fmt.Sprintf("(%-S).%s.%s%s", t0, nsym.Pkg.Prefix, nsym.Name, suffix)
} else {
- p = fmt.Sprintf("%-1v.%s.%s%s", t0, nsym.Pkg.Prefix, nsym.Name, suffix)
+ p = fmt.Sprintf("%-S.%s.%s%s", t0, nsym.Pkg.Prefix, nsym.Name, suffix)
}
} else {
if t0.Sym == nil && t0.IsPtr() {
- p = fmt.Sprintf("(%-1v).%s%s", t0, nsym.Name, suffix)
+ p = fmt.Sprintf("(%-S).%s%s", t0, nsym.Name, suffix)
} else {
- p = fmt.Sprintf("%-1v.%s%s", t0, nsym.Name, suffix)
+ p = fmt.Sprintf("%-S.%s%s", t0, nsym.Name, suffix)
}
}
default:
// Should have picked off all the reasons above,
// but just in case, fall back to generic error.
- Yyerror("invalid receiver type %v (%2v / %2v)", pa, pa, t)
+ Yyerror("invalid receiver type %v (%L / %L)", pa, pa, t)
}
return
}
if Debug['m'] != 0 {
for _, n := range e.noesc {
if n.Esc == EscNone {
- Warnl(n.Lineno, "%v %1v does not escape", e.curfnSym(n), n)
+ Warnl(n.Lineno, "%v %S does not escape", e.curfnSym(n), n)
}
}
}
// b escapes as well. If we ignore such OSLICEARR, we will conclude
// that b does not escape when b contents do.
if Debug['m'] != 0 {
- Warnl(n.Lineno, "%v ignoring self-assignment to %1v", e.curfnSym(n), n.Left)
+ Warnl(n.Lineno, "%v ignoring self-assignment to %S", e.curfnSym(n), n.Left)
}
break
slice2 := n.List.Second()
escassignDereference(e, &e.theSink, slice2, e.stepAssign(nil, n, slice2, "appended slice...")) // lose track of assign of dereference
if Debug['m'] > 3 {
- Warnl(n.Lineno, "%v special treatment of append(slice1, slice2...) %1v", e.curfnSym(n), n)
+ Warnl(n.Lineno, "%v special treatment of append(slice1, slice2...) %S", e.curfnSym(n), n)
}
}
escassignDereference(e, &e.theSink, n.List.First(), e.stepAssign(nil, n, n.List.First(), "appendee slice")) // The original elements are now leaked, too
}
if Debug['m'] > 2 {
- fmt.Printf("%v:[%d] %v escassign: %1v(%0j)[%v] = %1v(%0j)[%v]\n",
+ fmt.Printf("%v:[%d] %v escassign: %S(%0j)[%v] = %S(%0j)[%v]\n",
linestr(lineno), e.loopdepth, funcSym(Curfn),
dst, dst, dst.Op,
src, src, src.Op)
}
if Debug['m'] > 3 {
- fmt.Printf("%v::assignfromtag:: src=%1v, em=%s\n",
+ fmt.Printf("%v::assignfromtag:: src=%S, em=%s\n",
linestr(lineno), src, describeEscape(em))
}
for _, n1 := range ll.Slice() {
escassignSinkNilWhy(e, n, n1, "parameter to indirect call")
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: indirect call <- %1v, untracked\n", linestr(lineno), n1)
+ fmt.Printf("%v::esccall:: indirect call <- %S, untracked\n", linestr(lineno), n1)
}
}
// Set up bogus outputs
if fn != nil && fn.Op == ONAME && fn.Class == PFUNC &&
fn.Name.Defn != nil && fn.Name.Defn.Nbody.Len() != 0 && fn.Name.Param.Ntype != nil && fn.Name.Defn.Esc < EscFuncTagged {
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: %1v in recursive group\n", linestr(lineno), n)
+ fmt.Printf("%v::esccall:: %S in recursive group\n", linestr(lineno), n)
}
// function in same mutually recursive group. Incorporate into flow graph.
// "..." arguments are untracked
for _, n2 := range lls {
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: ... <- %1v, untracked\n", linestr(lineno), n2)
+ fmt.Printf("%v::esccall:: ... <- %S, untracked\n", linestr(lineno), n2)
}
escassignSinkNilWhy(e, src, n2, "... arg to recursive call")
}
}
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: %1v not recursive\n", linestr(lineno), n)
+ fmt.Printf("%v::esccall:: %S not recursive\n", linestr(lineno), n)
}
// set up out list on this call node with dummy auto ONAMES in the current (calling) function.
// Store arguments into slice for ... arg.
for ; i < len(lls); i++ {
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: ... <- %1v\n", linestr(lineno), lls[i])
+ fmt.Printf("%v::esccall:: ... <- %S\n", linestr(lineno), lls[i])
}
if note == uintptrEscapesTag {
escassignSinkNilWhy(e, src, lls[i], "arg to uintptrescapes ...")
}
if Debug['m'] > 3 {
- fmt.Printf("%v::flows:: %1v <- %1v\n", linestr(lineno), dst, src)
+ fmt.Printf("%v::flows:: %S <- %S\n", linestr(lineno), dst, src)
}
dstE := e.nodeEscState(dst)
dstE := e.nodeEscState(dst)
if Debug['m'] > 2 {
- fmt.Printf("\nescflood:%d: dst %1v scope:%v[%d]\n", e.walkgen, dst, e.curfnSym(dst), dstE.Escloopdepth)
+ fmt.Printf("\nescflood:%d: dst %S scope:%v[%d]\n", e.walkgen, dst, e.curfnSym(dst), dstE.Escloopdepth)
}
for i, l := range dstE.Escflowsrc {
if nextDest != nil {
dst = nextDest.src
}
- Warnl(src.Lineno, "\tfrom %s (%s) at %s", dst, step.why, dst.Line())
+ Warnl(src.Lineno, "\tfrom %v (%s) at %s", dst, step.why, dst.Line())
}
for step := step0; step != nil && step.busy; step = step.parent {
step.busy = false
}
if Debug['m'] > 2 {
- fmt.Printf("escwalk: level:%d depth:%d %.*s op=%v %1v(%0j) scope:%v[%d] extraloopdepth=%v\n",
+ fmt.Printf("escwalk: level:%d depth:%d %.*s op=%v %S(%0j) scope:%v[%d] extraloopdepth=%v\n",
level, e.pdepth, e.pdepth, "\t\t\t\t\t\t\t\t\t\t", src.Op, src, src, e.curfnSym(src), srcE.Escloopdepth, extraloopdepth)
}
// 4. return *in
if Debug['m'] != 0 {
if Debug['m'] <= 2 {
- Warnl(src.Lineno, "leaking param: %1v to result %v level=%v", src, dst.Sym, level.int())
+ Warnl(src.Lineno, "leaking param: %S to result %v level=%v", src, dst.Sym, level.int())
step.describe(src)
} else {
- Warnl(src.Lineno, "leaking param: %1v to result %v level=%v", src, dst.Sym, level)
+ Warnl(src.Lineno, "leaking param: %S to result %v level=%v", src, dst.Sym, level)
}
}
if src.Esc&EscMask != EscReturn {
level.int() > 0 {
src.Esc = escMax(EscContentEscapes|src.Esc, EscNone)
if Debug['m'] != 0 {
- Warnl(src.Lineno, "mark escaped content: %1v", src)
+ Warnl(src.Lineno, "mark escaped content: %S", src)
step.describe(src)
}
}
if Debug['m'] != 0 {
if Debug['m'] <= 2 {
if osrcesc != src.Esc {
- Warnl(src.Lineno, "leaking param content: %1v", src)
+ Warnl(src.Lineno, "leaking param content: %S", src)
step.describe(src)
}
} else {
- Warnl(src.Lineno, "leaking param content: %1v level=%v dst.eld=%v src.eld=%v dst=%1v",
+ Warnl(src.Lineno, "leaking param content: %S level=%v dst.eld=%v src.eld=%v dst=%S",
src, level, dstE.Escloopdepth, modSrcLoopdepth, dst)
}
}
if Debug['m'] != 0 {
if Debug['m'] <= 2 {
- Warnl(src.Lineno, "leaking param: %1v", src)
+ Warnl(src.Lineno, "leaking param: %S", src)
step.describe(src)
} else {
- Warnl(src.Lineno, "leaking param: %1v level=%v dst.eld=%v src.eld=%v dst=%1v",
+ Warnl(src.Lineno, "leaking param: %S level=%v dst.eld=%v src.eld=%v dst=%S",
src, level, dstE.Escloopdepth, modSrcLoopdepth, dst)
}
}
// original variable.
if src.isClosureVar() {
if leaks && Debug['m'] != 0 {
- Warnl(src.Lineno, "leaking closure reference %1v", src)
+ Warnl(src.Lineno, "leaking closure reference %S", src)
step.describe(src)
}
escwalk(e, level, dst, src.Name.Defn, e.stepWalk(dst, src.Name.Defn, "closure-var", step))
p = p.Left // merely to satisfy error messages in tests
}
if Debug['m'] > 2 {
- Warnl(src.Lineno, "%1v escapes to heap, level=%v, dst=%v dst.eld=%v, src.eld=%v",
+ Warnl(src.Lineno, "%S escapes to heap, level=%v, dst=%v dst.eld=%v, src.eld=%v",
p, level, dst, dstE.Escloopdepth, modSrcLoopdepth)
} else {
- Warnl(src.Lineno, "%1v escapes to heap", p)
+ Warnl(src.Lineno, "%S escapes to heap", p)
step.describe(src)
}
}
if leaks {
src.Esc = EscHeap
if Debug['m'] != 0 && osrcesc != src.Esc {
- Warnl(src.Lineno, "%1v escapes to heap", src)
+ Warnl(src.Lineno, "%S escapes to heap", src)
step.describe(src)
}
extraloopdepth = modSrcLoopdepth
if leaks {
src.Esc = EscHeap
if Debug['m'] != 0 && osrcesc != src.Esc {
- Warnl(src.Lineno, "%1v escapes to heap", src)
+ Warnl(src.Lineno, "%S escapes to heap", src)
step.describe(src)
}
extraloopdepth = modSrcLoopdepth
case OCALLMETH, OCALLFUNC, OCALLINTER:
if srcE.Escretval.Len() != 0 {
if Debug['m'] > 2 {
- fmt.Printf("%v:[%d] dst %1v escwalk replace src: %1v with %1v\n",
+ fmt.Printf("%v:[%d] dst %S escwalk replace src: %S with %S\n",
linestr(lineno), e.loopdepth,
dst, src, srcE.Escretval.First())
}
declare(n, PEXTERN)
if Debug['E'] != 0 {
- fmt.Printf("import var %v %2v\n", s, t)
+ fmt.Printf("import var %v %L\n", s, t)
}
}
declare(n, PEXTERN)
checkwidth(pt)
} else if !Eqtype(pt.Orig, t) {
- Yyerror("inconsistent definition for type %v during import\n\t%2v (in %q)\n\t%2v (in %q)", pt.Sym, pt, pt.Sym.Importdef.Path, t, importpkg.Path)
+ Yyerror("inconsistent definition for type %v during import\n\t%L (in %q)\n\t%L (in %q)", pt.Sym, pt, pt.Sym.Importdef.Path, t, importpkg.Path)
}
if Debug['E'] != 0 {
- fmt.Printf("import type %v %2v\n", pt, t)
+ fmt.Printf("import type %v %L\n", pt, t)
}
}
"unicode/utf8"
)
+// TODO(gri) update documentation thoroughly
+
// A FmtFlag value is a set of flags (or 0).
// They control how the Xconv functions format their values.
// See the respective function's documentation for details.
type FmtFlag int
-const ( // fmt.Format flag/width/prec
+const ( // fmt.Format flag/prec or verb
FmtLeft FmtFlag = 1 << iota // "-" => '-'
FmtSharp // "#" => '#'
FmtSign // "+" => '+'
FmtUnsigned // "u" => ' '
- FmtShort // "h" => hasWidth && width == 1; or verb == 'S' (Short)
- FmtLong // "l" => hasWidth && width == 2; or verb == 'L' (Long)
+ FmtShort // "h" => verb == 'S' (Short)
+ FmtLong // "l" => verb == 'L' (Long)
FmtComma // "," => '.' (== hasPrec)
FmtByte // "hh" => '0'
)
if s.Flag(' ') {
flag |= FmtUnsigned
}
- if w, ok := s.Width(); ok {
- switch w {
- case 1:
- flag |= FmtShort
- case 2:
- flag |= FmtLong
- }
- }
if _, ok := s.Precision(); ok {
flag |= FmtComma
}
func (o Op) Format(s fmt.State, verb rune) {
switch verb {
- case 's', 'v':
+ case 'v':
o.oconv(s, fmtFlag(s, verb))
default:
func (n *Node) Format(s fmt.State, verb rune) {
switch verb {
- case 's', 'v':
+ case 'v', 'S', 'L':
n.Nconv(s, fmtFlag(s, verb))
case 'j':
func (v Val) Format(s fmt.State, verb rune) {
switch verb {
- case 's', 'v':
+ case 'v':
v.vconv(s, fmtFlag(s, verb))
default:
- fmt.Fprintf(s, "%%!%c(Val)", verb)
+ fmt.Fprintf(s, "%%!%c(Val=%T)", verb, v)
}
}
if t == bytetype || t == runetype {
// in %-T mode collapse rune and byte with their originals.
if fmtmode != FTypeId {
- fmt.Fprintf(s, "%1v", t.Sym)
+ fmt.Fprintf(s, "%S", t.Sym)
return
}
t = Types[t.Etype]
case FTypeId:
if flag&FmtShort != 0 {
if t.Vargen != 0 {
- fmt.Fprintf(s, "%1v·%d", t.Sym, t.Vargen)
+ fmt.Fprintf(s, "%S·%d", t.Sym, t.Vargen)
return
}
- fmt.Fprintf(s, "%1v", t.Sym)
+ fmt.Fprintf(s, "%S", t.Sym)
return
}
switch t.Etype {
case TPTR32, TPTR64:
if fmtmode == FTypeId && (flag&FmtShort != 0) {
- fmt.Fprintf(s, "*%1v", t.Elem())
+ fmt.Fprintf(s, "*%S", t.Elem())
return
}
fmt.Fprint(s, "*"+t.Elem().String())
// Wrong interface definitions may have types lacking a symbol.
break
case exportname(f.Sym.Name):
- fmt.Fprintf(s, "%1v", f.Sym)
+ fmt.Fprintf(s, "%S", f.Sym)
default:
fmt.Fprintf(s, "% v", f.Sym)
}
- fmt.Fprintf(s, "%1v", f.Type)
+ fmt.Fprintf(s, "%S", f.Type)
}
if t.NumFields() != 0 {
fmt.Fprint(s, " ")
}
}
- fmt.Fprintf(s, "%s", n.Val())
+ fmt.Fprintf(s, "%v", n.Val())
// Special case: name used as local variable in export.
// _ becomes ~b%d internally; print as _ for export
fmt.Fprint(s, ".<nil>")
return
}
- fmt.Fprintf(s, ".%01v", n.Right.Sym)
+ fmt.Fprintf(s, ".%0S", n.Right.Sym)
case OXDOT, ODOT, ODOTPTR, ODOTINTER, ODOTMETH:
n.Left.exprfmt(s, nprec)
fmt.Fprint(s, ".<nil>")
return
}
- fmt.Fprintf(s, ".%01v", n.Sym)
+ fmt.Fprintf(s, ".%0S", n.Sym)
case ODOTTYPE, ODOTTYPE2:
n.Left.exprfmt(s, nprec)
func (s *Sym) Format(f fmt.State, verb rune) {
switch verb {
- case 's', 'v':
+ case 'v', 'S':
s.sconv(f, fmtFlag(f, verb))
default:
if f.Funarg != FunargNone {
name = f.Nname.String()
} else if flag&FmtLong != 0 {
- name = fmt.Sprintf("%01v", s)
+ name = fmt.Sprintf("%0S", s)
if !exportname(name) && flag&FmtUnsigned == 0 {
name = s.String() // qualify non-exported names (used on structs, not on funarg)
}
func (t *Type) Format(s fmt.State, verb rune) {
switch verb {
- case 's', 'v':
+ case 'v', 'S', 'L':
t.tconv(s, fmtFlag(s, verb))
default:
func (l Nodes) Format(s fmt.State, verb rune) {
switch verb {
- case 's', 'v':
+ case 'v':
l.hconv(s, fmtFlag(s, verb))
default:
switch n.Op {
default:
- Fatalf("gen: unknown op %+1v", n)
+ Fatalf("gen: unknown op %+S", n)
case OCASE,
OFALL,
}
switch u := n.Val().U.(type) {
default:
- Fatalf("naddr: const %2v", n.Type)
+ Fatalf("naddr: const %L", n.Type)
case *Mpflt:
a.Type = obj.TYPE_FCONST
rcvr = rcvr.Elem()
}
if rcvr.Sym == nil {
- Fatalf("receiver with no sym: [%v] %2v (%v)", fn.Sym, fn, rcvr)
+ Fatalf("receiver with no sym: [%v] %L (%v)", fn.Sym, fn, rcvr)
}
return rcvr.Sym.Pkg
}
}
if Debug['m'] > 2 || Debug_export != 0 {
- fmt.Printf("typecheck import [%v] %2v { %#v }\n", fn.Sym, fn, fn.Func.Inl)
+ fmt.Printf("typecheck import [%v] %L { %#v }\n", fn.Sym, fn, fn.Func.Inl)
}
save_safemode := safemode
case OCALLMETH:
if Debug['m'] > 3 {
- fmt.Printf("%v:call to meth %2v\n", n.Line(), n.Left.Right)
+ fmt.Printf("%v:call to meth %L\n", n.Line(), n.Left.Right)
}
// typecheck should have resolved ODOTMETH->type, whose nname points to the actual function.
s := LookupBytes(name)
if Debug['x'] != 0 {
- fmt.Printf("lex: ident %s\n", s)
+ fmt.Printf("lex: ident %v\n", s)
}
l.sym_ = s
l.nlsemi = true
if expr.Lhs != nil {
n.Left = p.declName(expr.Lhs)
if isblank(n.Left) {
- Yyerror("invalid variable name %s in type switch", n.Left)
+ Yyerror("invalid variable name %v in type switch", n.Left)
}
}
return n
case OADDR:
if nr.Left.Op != ONAME {
- Fatalf("gdata ADDR left op %s", nr.Left.Op)
+ Fatalf("gdata ADDR left op %v", nr.Left.Op)
}
to := nr.Left
Linksym(nam.Sym).WriteAddr(Ctxt, nam.Xoffset, wid, Linksym(to.Sym), to.Xoffset)
if len(lhs) > 1 {
Yyerror("argument count mismatch: %d = %d", len(lhs), 1)
} else if (lhs[0].Op != ONAME && lhs[0].Op != OTYPE && lhs[0].Op != ONONAME && (lhs[0].Op != OLITERAL || lhs[0].Name == nil)) || isblank(lhs[0]) {
- Yyerror("invalid variable name %s in type switch", lhs[0])
+ Yyerror("invalid variable name %v in type switch", lhs[0])
} else {
ts.Left = dclname(lhs[0].Sym)
} // it's a colas, so must not re-use an oldname
if !n.Name.Needzero {
n.Name.Needzero = true
if debuglive >= 1 {
- Warnl(p.Lineno, "%v: %2v is ambiguously live", Curfn.Func.Nname, n)
+ Warnl(p.Lineno, "%v: %L is ambiguously live", Curfn.Func.Nname, n)
}
// Record in 'ambiguous' bitmap.
}
n := lv.vars[j]
if n.Class != PPARAM {
- yyerrorl(p.Lineno, "internal error: %v %2v recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, n, p.Pc)
+ yyerrorl(p.Lineno, "internal error: %v %L recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, n, p.Pc)
}
}
}
toomany = 0
switch t.Etype {
default:
- Yyerror("cannot range over %2v", n.Right)
+ Yyerror("cannot range over %L", n.Right)
goto out
case TARRAY, TSLICE:
if v1.Name != nil && v1.Name.Defn == n {
v1.Type = t1
} else if v1.Type != nil && assignop(t1, v1.Type, &why) == 0 {
- Yyerror("cannot assign type %v to %2v in range%s", t1, v1, why)
+ Yyerror("cannot assign type %v to %L in range%s", t1, v1, why)
}
checkassign(n, v1)
}
if v2.Name != nil && v2.Name.Defn == n {
v2.Type = t2
} else if v2.Type != nil && assignop(t2, v2.Type, &why) == 0 {
- Yyerror("cannot assign type %v to %2v in range%s", t2, v2, why)
+ Yyerror("cannot assign type %v to %L in range%s", t2, v2, why)
}
checkassign(n, v2)
}
}
noff := int(Rnd(int64(ot), int64(Widthptr)))
if noff != ot {
- Fatalf("unexpected alignment in dextratype for %s", t)
+ Fatalf("unexpected alignment in dextratype for %v", t)
}
for _, a := range m {
dataAdd += uncommonSize(t)
mcount := len(m)
if mcount != int(uint16(mcount)) {
- Fatalf("too many methods on %s: %d", t, mcount)
+ Fatalf("too many methods on %v: %d", t, mcount)
}
if dataAdd != int(uint32(dataAdd)) {
- Fatalf("methods are too far away on %s: %d", t, dataAdd)
+ Fatalf("methods are too far away on %v: %d", t, dataAdd)
}
ot = duint16(s, ot, uint16(mcount))
case OVARLIVE:
// Insert a varlive op to record that a variable is still live.
if !n.Left.Addrtaken {
- s.Fatalf("VARLIVE variable %s must have Addrtaken set", n.Left)
+ s.Fatalf("VARLIVE variable %v must have Addrtaken set", n.Left)
}
s.vars[&memVar] = s.newValue1A(ssa.OpVarLive, ssa.TypeMem, n.Left, s.mem())
s.expr(n.Left)
default:
- s.Unimplementedf("unhandled stmt %s", n.Op)
+ s.Unimplementedf("unhandled stmt %v", n.Op)
}
}
etype := s.concreteEtype(t)
x, ok := opToSSA[opAndType{op, etype}]
if !ok {
- s.Unimplementedf("unhandled binary op %s %s", op, etype)
+ s.Unimplementedf("unhandled binary op %v %s", op, etype)
}
return x
}
etype2 := s.concreteEtype(u)
x, ok := shiftOpToSSA[opAndTwoTypes{op, etype1, etype2}]
if !ok {
- s.Unimplementedf("unhandled shift op %s etype=%s/%s", op, etype1, etype2)
+ s.Unimplementedf("unhandled shift op %v etype=%s/%s", op, etype1, etype2)
}
return x
}
etype1 := s.concreteEtype(t)
x, ok := opToSSA[opAndType{op, etype1}]
if !ok {
- s.Unimplementedf("unhandled rotate op %s etype=%s", op, etype1)
+ s.Unimplementedf("unhandled rotate op %v etype=%s", op, etype1)
}
return x
}
case 84:
op = ssa.OpTrunc64to32
default:
- s.Fatalf("weird integer truncation %s -> %s", ft, tt)
+ s.Fatalf("weird integer truncation %v -> %v", ft, tt)
}
} else if ft.IsSigned() {
// sign extension
case 48:
op = ssa.OpSignExt32to64
default:
- s.Fatalf("bad integer sign extension %s -> %s", ft, tt)
+ s.Fatalf("bad integer sign extension %v -> %v", ft, tt)
}
} else {
// zero extension
case 48:
op = ssa.OpZeroExt32to64
default:
- s.Fatalf("weird integer sign extension %s -> %s", ft, tt)
+ s.Fatalf("weird integer sign extension %v -> %v", ft, tt)
}
}
return s.newValue1(op, n.Type, x)
}
}
if !ok {
- s.Fatalf("weird float conversion %s -> %s", ft, tt)
+ s.Fatalf("weird float conversion %v -> %v", ft, tt)
}
op1, op2, it := conv.op1, conv.op2, conv.intermediateType
if tt.Size() == 8 {
return s.uint64Tofloat64(n, x, ft, tt)
}
- s.Fatalf("weird unsigned integer to float conversion %s -> %s", ft, tt)
+ s.Fatalf("weird unsigned integer to float conversion %v -> %v", ft, tt)
}
// therefore ft is float32 or float64, and tt is unsigned integer
if ft.Size() == 4 {
if ft.Size() == 8 {
return s.float64ToUint64(n, x, ft, tt)
}
- s.Fatalf("weird float to unsigned integer conversion %s -> %s", ft, tt)
+ s.Fatalf("weird float to unsigned integer conversion %v -> %v", ft, tt)
return nil
}
} else if ft.Size() == 16 && tt.Size() == 8 {
op = ssa.OpCvt64Fto32F
} else {
- s.Fatalf("weird complex conversion %s -> %s", ft, tt)
+ s.Fatalf("weird complex conversion %v -> %v", ft, tt)
}
ftp := floatForComplex(ft)
ttp := floatForComplex(tt)
case ONE:
return s.newValue1(ssa.OpNot, Types[TBOOL], c)
default:
- s.Fatalf("ordered complex compare %s", n.Op)
+ s.Fatalf("ordered complex compare %v", n.Op)
}
}
return s.newValue2(s.ssaOp(n.Op, n.Left.Type), Types[TBOOL], a, b)
return s.append(n, false)
default:
- s.Unimplementedf("unhandled expr %s", n.Op)
+ s.Unimplementedf("unhandled expr %v", n.Op)
return nil
}
}
dowidth(t)
if s.canSSA(left) {
if deref {
- s.Fatalf("can SSA LHS %s but not RHS %s", left, right)
+ s.Fatalf("can SSA LHS %v but not RHS %s", left, right)
}
if left.Op == ODOT {
// We're assigning to a field of an ssa-able value.
case 8:
return s.constInt64(t, 0)
default:
- s.Fatalf("bad sized integer type %s", t)
+ s.Fatalf("bad sized integer type %v", t)
}
case t.IsFloat():
switch t.Size() {
case 8:
return s.constFloat64(t, 0)
default:
- s.Fatalf("bad sized float type %s", t)
+ s.Fatalf("bad sized float type %v", t)
}
case t.IsComplex():
switch t.Size() {
z := s.constFloat64(Types[TFLOAT64], 0)
return s.entryNewValue2(ssa.OpComplexMake, t, z, z)
default:
- s.Fatalf("bad sized complex type %s", t)
+ s.Fatalf("bad sized complex type %v", t)
}
case t.IsString():
case sym != nil:
call = s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, sym, s.mem())
default:
- Fatalf("bad call type %s %v", n.Op, n)
+ Fatalf("bad call type %v %v", n.Op, n)
}
call.AuxInt = stksize // Call operations carry the argsize of the callee along with them
s.storeTypeScalars(ft.(*Type), addr, val, 0)
}
default:
- s.Fatalf("bad write barrier type %s", t)
+ s.Fatalf("bad write barrier type %v", t)
}
}
s.storeTypePtrs(ft.(*Type), addr, val)
}
default:
- s.Fatalf("bad write barrier type %s", t)
+ s.Fatalf("bad write barrier type %v", t)
}
}
s.storeTypePtrsWB(ft.(*Type), addr, val)
}
default:
- s.Fatalf("bad write barrier type %s", t)
+ s.Fatalf("bad write barrier type %v", t)
}
}
target := s.expr(typename(n.Type)) // target type
if !isdirectiface(n.Type) {
// walk rewrites ODOTTYPE/OAS2DOTTYPE into runtime calls except for this case.
- Fatalf("dottype needs a direct iface type %s", n.Type)
+ Fatalf("dottype needs a direct iface type %v", n.Type)
}
if Debug_typeassert > 0 {
addr := s.decladdrs[name]
if addr == nil {
// TODO: closure args reach here.
- s.Unimplementedf("unhandled closure arg %s at entry to function %s", name, b.Func.Name)
+ s.Unimplementedf("unhandled closure arg %v at entry to function %s", name, b.Func.Name)
}
if _, ok := addr.Aux.(*ssa.ArgSymbol); !ok {
- s.Fatalf("variable live at start of function %s is not an argument %s", b.Func.Name, name)
+ s.Fatalf("variable live at start of function %s is not an argument %v", b.Func.Name, name)
}
v.Op = ssa.OpLoad
v.AddArgs(addr, s.startmem)
return
}
if n.Class == PAUTO && n.Xoffset != 0 {
- s.Fatalf("AUTO var with offset %s %d", n, n.Xoffset)
+ s.Fatalf("AUTO var with offset %v %d", n, n.Xoffset)
}
loc := ssa.LocalSlot{N: n, Type: n.Type, Off: 0}
values, ok := s.f.NamedValues[loc]
v.Fatalf("KeepAlive with non-spilled value %s %s", v, v.Args[0])
}
if off != 0 {
- v.Fatalf("KeepAlive with non-zero offset spill location %s:%d", n, off)
+ v.Fatalf("KeepAlive with non-zero offset spill location %v:%d", n, off)
}
Gvarlive(n)
}
}
return i
}
- panic(fmt.Sprintf("can't find field in expr %s\n", n))
+ panic(fmt.Sprintf("can't find field in expr %v\n", n))
// TODO: keep the result of this function somewhere in the ODOT Node
// so we don't have to recompute it each time we need it.
} else if have != nil && have.Sym == missing.Sym && have.Nointerface {
*why = fmt.Sprintf(":\n\t%v does not implement %v (%v method is marked 'nointerface')", src, dst, missing.Sym)
} else if have != nil && have.Sym == missing.Sym {
- *why = fmt.Sprintf(":\n\t%v does not implement %v (wrong type for %v method)\n"+"\t\thave %v%01v\n\t\twant %v%01v", src, dst, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
+ *why = fmt.Sprintf(":\n\t%v does not implement %v (wrong type for %v method)\n"+
+ "\t\thave %v%0S\n\t\twant %v%0S", src, dst, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else if ptr != 0 {
*why = fmt.Sprintf(":\n\t%v does not implement %v (%v method has pointer receiver)", src, dst, missing.Sym)
} else if have != nil {
- *why = fmt.Sprintf(":\n\t%v does not implement %v (missing %v method)\n"+"\t\thave %v%01v\n\t\twant %v%01v", src, dst, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
+ *why = fmt.Sprintf(":\n\t%v does not implement %v (missing %v method)\n"+
+ "\t\thave %v%0S\n\t\twant %v%0S", src, dst, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else {
*why = fmt.Sprintf(":\n\t%v does not implement %v (missing %v method)", src, dst, missing.Sym)
}
var why string
op := assignop(n.Type, t, &why)
if op == 0 {
- Yyerror("cannot use %2v as type %v in %s%s", n, t, context(), why)
+ Yyerror("cannot use %L as type %v in %s%s", n, t, context(), why)
op = OCONV
}
}
return n.Right.Left, n.Right.Right.Left, n.Right.Right.Right
}
- Fatalf("SliceBounds op %s: %v", n.Op, n)
+ Fatalf("SliceBounds op %v: %v", n.Op, n)
return nil, nil, nil
}
switch n.Op {
case OSLICE, OSLICEARR, OSLICESTR:
if max != nil {
- Fatalf("SetSliceBounds %s given three bounds", n.Op)
+ Fatalf("SetSliceBounds %v given three bounds", n.Op)
}
if n.Right == nil {
n.Right = Nod(OKEY, low, high)
n.Right.Right.Right = max
return
}
- Fatalf("SetSliceBounds op %s: %v", n.Op, n)
+ Fatalf("SetSliceBounds op %v: %v", n.Op, n)
}
// IsSlice3 reports whether o is a slice3 op (OSLICE3, OSLICE3ARR).
n.Left.Right = typecheck(n.Left.Right, Erv)
t = n.Left.Right.Type
if t != nil && !t.IsInterface() {
- Yyerror("cannot type switch on non-interface value %2v", n.Left.Right)
+ Yyerror("cannot type switch on non-interface value %L", n.Left.Right)
}
} else {
// expression switch
if t != nil {
switch {
case !okforeq[t.Etype]:
- Yyerror("cannot switch on %2v", n.Left)
+ Yyerror("cannot switch on %L", n.Left)
case t.IsSlice():
nilonly = "slice"
case t.IsArray() && !t.IsComparable():
- Yyerror("cannot switch on %2v", n.Left)
+ Yyerror("cannot switch on %L", n.Left)
case t.IsStruct():
if f := t.IncomparableField(); f != nil {
- Yyerror("cannot switch on %2v (struct containing %v cannot be compared)", n.Left, f.Type)
+ Yyerror("cannot switch on %L (struct containing %v cannot be compared)", n.Left, f.Type)
}
case t.Etype == TFUNC:
nilonly = "func"
case nilonly != "" && !isnil(n1):
Yyerror("invalid case %v in switch (can only compare %s %v to nil)", n1, nilonly, n.Left)
case t.IsInterface() && !n1.Type.IsInterface() && !n1.Type.IsComparable():
- Yyerror("invalid case %2v in switch (incomparable type)", n1)
+ Yyerror("invalid case %L in switch (incomparable type)", n1)
}
// type switch
niltype = ncase
}
case n1.Op != OTYPE && n1.Type != nil: // should this be ||?
- Yyerror("%2v is not a type", n1)
+ Yyerror("%L is not a type", n1)
// reset to original type
n1 = n.Left.Right
ls[i1] = n1
case !n1.Type.IsInterface() && t.IsInterface() && !implements(n1.Type, t, &missing, &have, &ptr):
if have != nil && !missing.Broke && !have.Broke {
- Yyerror("impossible type switch case: %2v cannot have dynamic type %v"+" (wrong type for %v method)\n\thave %v%1v\n\twant %v%1v", n.Left.Right, n1.Type, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
+ Yyerror("impossible type switch case: %L cannot have dynamic type %v"+
+ " (wrong type for %v method)\n\thave %v%S\n\twant %v%S", n.Left.Right, n1.Type, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else if !missing.Broke {
- Yyerror("impossible type switch case: %2v cannot have dynamic type %v"+" (missing %v method)", n.Left.Right, n1.Type, missing.Sym)
+ Yyerror("impossible type switch case: %L cannot have dynamic type %v"+
+ " (missing %v method)", n.Left.Right, n1.Type, missing.Sym)
}
}
}
}
default:
- e := fmt.Sprintf("Do not know how to compare %s with %s", t, x)
+ e := fmt.Sprintf("Do not know how to compare %v with %v", t, x)
panic(e)
}
if !t.IsPtr() {
if top&(Erv|Etop) != 0 {
- Yyerror("invalid indirect of %2v", n.Left)
+ Yyerror("invalid indirect of %L", n.Left)
n.Type = nil
return n
}
}
if n.Type.Etype != TFUNC || !n.IsMethod() {
- Yyerror("type %v has no method %1v", n.Left.Type, n.Right.Sym)
+ Yyerror("type %v has no method %S", n.Left.Type, n.Right.Sym)
n.Type = nil
return n
}
var ptr int
if !implements(n.Type, t, &missing, &have, &ptr) {
if have != nil && have.Sym == missing.Sym {
- Yyerror("impossible type assertion:\n\t%v does not implement %v (wrong type for %v method)\n"+"\t\thave %v%01v\n\t\twant %v%01v", n.Type, t, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
+ Yyerror("impossible type assertion:\n\t%v does not implement %v (wrong type for %v method)\n"+
+ "\t\thave %v%0S\n\t\twant %v%0S", n.Type, t, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else if ptr != 0 {
Yyerror("impossible type assertion:\n\t%v does not implement %v (%v method has pointer receiver)", n.Type, t, missing.Sym)
} else if have != nil {
- Yyerror("impossible type assertion:\n\t%v does not implement %v (missing %v method)\n"+"\t\thave %v%01v\n\t\twant %v%01v", n.Type, t, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
+ Yyerror("impossible type assertion:\n\t%v does not implement %v (missing %v method)\n"+
+ "\t\thave %v%0S\n\t\twant %v%0S", n.Type, t, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else {
Yyerror("impossible type assertion:\n\t%v does not implement %v (missing %v method)", n.Type, t, missing.Sym)
}
break OpSwitch
badcall1:
- Yyerror("invalid argument %2v for %v", n.Left, n.Op)
+ Yyerror("invalid argument %L for %v", n.Left, n.Op)
n.Type = nil
return n
l := args.First()
r := args.Second()
if l.Type != nil && !l.Type.IsMap() {
- Yyerror("first argument to delete must be map; have %2v", l.Type)
+ Yyerror("first argument to delete must be map; have %L", l.Type)
n.Type = nil
return n
}
return n
}
- Yyerror("first argument to append must be slice; have %2v", t)
+ Yyerror("first argument to append must be slice; have %L", t)
n.Type = nil
return n
}
if Eqtype(n.Left.Type.Elem(), bytetype) {
break OpSwitch
}
- Yyerror("arguments to copy have different element types: %2v and string", n.Left.Type)
+ Yyerror("arguments to copy have different element types: %L and string", n.Left.Type)
n.Type = nil
return n
}
if !n.Left.Type.IsSlice() || !n.Right.Type.IsSlice() {
if !n.Left.Type.IsSlice() && !n.Right.Type.IsSlice() {
- Yyerror("arguments to copy must be slices; have %2v, %2v", n.Left.Type, n.Right.Type)
+ Yyerror("arguments to copy must be slices; have %L, %L", n.Left.Type, n.Right.Type)
} else if !n.Left.Type.IsSlice() {
- Yyerror("first argument to copy should be slice; have %2v", n.Left.Type)
+ Yyerror("first argument to copy should be slice; have %L", n.Left.Type)
} else {
- Yyerror("second argument to copy should be slice or string; have %2v", n.Right.Type)
+ Yyerror("second argument to copy should be slice or string; have %L", n.Right.Type)
}
n.Type = nil
return n
}
if !Eqtype(n.Left.Type.Elem(), n.Right.Type.Elem()) {
- Yyerror("arguments to copy have different element types: %2v and %2v", n.Left.Type, n.Right.Type)
+ Yyerror("arguments to copy have different element types: %L and %L", n.Left.Type, n.Right.Type)
n.Type = nil
return n
}
n.Op = convertop(t, n.Type, &why)
if n.Op == 0 {
if n.Diag == 0 && !n.Type.Broke {
- Yyerror("cannot convert %2v to type %v%s", n.Left, n.Type, why)
+ Yyerror("cannot convert %L to type %v%s", n.Left, n.Type, why)
n.Diag = 1
}
if n.Left != nil {
t := n.Left.Type
if t != nil && !t.IsBoolean() {
- Yyerror("non-bool %2v used as for condition", n.Left)
+ Yyerror("non-bool %L used as for condition", n.Left)
}
}
n.Right = typecheck(n.Right, Etop)
if n.Left != nil {
t := n.Left.Type
if t != nil && !t.IsBoolean() {
- Yyerror("non-bool %2v used as if condition", n.Left)
+ Yyerror("non-bool %L used as if condition", n.Left)
}
}
typecheckslice(n.Nbody.Slice(), Etop)
// disallow T.m if m requires *T receiver
if f2.Type.Recv().Type.IsPtr() && !t.IsPtr() && f2.Embedded != 2 && !isifacemethod(f2.Type) {
- Yyerror("invalid method expression %v (needs pointer receiver: (*%v).%1v)", n, t, f2.Sym)
+ Yyerror("invalid method expression %v (needs pointer receiver: (*%v).%S)", n, t, f2.Sym)
return false
}
n.Left.Implicit = true
n.Left = typecheck(n.Left, Etype|Erv)
} else if tt.Etype == Tptr && tt.Elem().Etype == Tptr && Eqtype(derefall(tt), derefall(rcvr)) {
- Yyerror("calling method %v with receiver %2v requires explicit dereference", n.Sym, n.Left)
+ Yyerror("calling method %v with receiver %L requires explicit dereference", n.Sym, n.Left)
for tt.Etype == Tptr {
// Stop one level early for method with pointer receiver.
if rcvr.Etype == Tptr && tt.Elem().Etype != Tptr {
var why string
if assignop(src, dst.Type, &why) == 0 {
- Yyerror("cannot assign %v to %2v in multiple assignment%s", src, dst, why)
+ Yyerror("cannot assign %v to %L in multiple assignment%s", src, dst, why)
return
}
}
}
if !e.Type.IsUntyped() && !Eqtype(t, e.Type) {
- Yyerror("cannot use %2v as type %v in const initializer", e, t)
+ Yyerror("cannot use %L as type %v in const initializer", e, t)
goto ret
}
switch n.Op {
default:
Dump("walk", n)
- Fatalf("walkexpr: switch 1 unknown op %+1v", n)
+ Fatalf("walkexpr: switch 1 unknown op %+S", n)
case OTYPE,
ONONAME,
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %L has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
case gc.TFLOAT32:
switch op {
default:
- gc.Fatalf("ginscmp: no entry for op=%s type=%v", op, t)
+ gc.Fatalf("ginscmp: no entry for op=%v type=%v", op, t)
case gc.OEQ,
gc.ONE:
case gc.TFLOAT64:
switch op {
default:
- gc.Fatalf("ginscmp: no entry for op=%s type=%v", op, t)
+ gc.Fatalf("ginscmp: no entry for op=%v type=%v", op, t)
case gc.OEQ,
gc.ONE:
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %2v -> %2v\n", f, t)
+ fmt.Printf("gmove %L -> %L\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
switch uint32(ft)<<16 | uint32(tt) {
default:
- gc.Fatalf("gmove %2v -> %2v", f.Type, t.Type)
+ gc.Fatalf("gmove %L -> %L", f.Type, t.Type)
/*
* integer copy and truncate
a := obj.AXXX
switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) {
default:
- gc.Fatalf("optoas: no entry for op=%s type=%v", op, t)
+ gc.Fatalf("optoas: no entry for op=%v type=%v", op, t)
case OEQ_ | gc.TBOOL,
OEQ_ | gc.TINT8,
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %L has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %2v -> %2v\n", f, t)
+ fmt.Printf("gmove %L -> %L\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
switch uint32(ft)<<16 | uint32(tt) {
default:
- gc.Fatalf("gmove %2v -> %2v", f.Type, t.Type)
+ gc.Fatalf("gmove %L -> %L", f.Type, t.Type)
/*
* integer copy and truncate
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %L has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
// hard part is conversions.
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %2v -> %2v\n", f, t)
+ fmt.Printf("gmove %L -> %L\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
// otherwise handle and return.
switch uint32(ft)<<16 | uint32(tt) {
default:
- gc.Fatalf("gmove %2v -> %2v", f.Type, t.Type)
+ gc.Fatalf("gmove %L -> %L", f.Type, t.Type)
// integer copy and truncate
case gc.TINT8<<16 | gc.TINT8,
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %L has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width == lo-int64(2*gc.Widthptr) {
// merge with range we already have
// should not happen
fatal:
- gc.Fatalf("gmove %2v -> %2v", f, t)
+ gc.Fatalf("gmove %L -> %L", f, t)
return
}