And use base.Fatalf in code that use t.SetBroke(true) instead.
Updates #51691
Change-Id: I9f3613379dd82d0dd069cdf7b61cbb281810e2e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/394574
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
// this code a bit, especially the final case.
switch {
case top&(ctxStmt|ctxExpr) == ctxExpr && !isExpr && n.Op() != ir.OTYPE && !isMulti:
- base.Errorf("%v used as value", n)
- n.SetDiag(true)
- if t != nil {
- n.SetType(nil)
- }
+ base.Fatalf("%v used as value", n)
case top&ctxType == 0 && n.Op() == ir.OTYPE && t != nil:
- base.Errorf("type %v is not an expression", n.Type())
- n.SetDiag(true)
+ base.Fatalf("type %v is not an expression", n.Type())
case top&(ctxStmt|ctxExpr) == ctxStmt && !isStmt && t != nil:
- base.Errorf("%v evaluated but not used", n)
- n.SetDiag(true)
- n.SetType(nil)
+ base.Fatalf("%v evaluated but not used", n)
case top&(ctxType|ctxExpr) == ctxType && n.Op() != ir.OTYPE && n.Op() != ir.ONONAME && (t != nil || n.Op() == ir.ONAME):
- base.Errorf("%v is not a type", n)
- if t != nil {
- if n.Op() == ir.ONAME {
- t.SetBroke(true)
- } else {
- n.SetType(nil)
- }
- }
-
+ base.Fatalf("%v is not a type", n)
}
base.Pos = lno
if AllowsGoVersion(t.Pkg(), 1, 18) {
continue
}
- base.ErrorfAt(m.Pos, "interface contains embedded non-interface, non-union %v", m.Type)
- m.SetBroke(true)
- t.SetBroke(true)
- // Add to fields so that error messages
- // include the broken embedded type when
- // printing t.
- // TODO(mdempsky): Revisit this.
- methods = append(methods, m)
- continue
+ base.FatalfAt(m.Pos, "interface contains embedded non-interface, non-union %v", m.Type)
}
// Embedded interface: duplicate all methods
}
if CalcSizeDisabled {
- t.SetBroke(true)
base.Fatalf("width not calculated: %v", t)
}
func (t *Type) HasShape() bool { return t.flags&typeHasShape != 0 }
func (t *Type) SetNotInHeap(b bool) { t.flags.set(typeNotInHeap, b) }
-func (t *Type) SetBroke(b bool) { base.Assertf(!b, "SetBroke") }
func (t *Type) SetNoalg(b bool) { t.flags.set(typeNoalg, b) }
func (t *Type) SetDeferwidth(b bool) { t.flags.set(typeDeferwidth, b) }
func (t *Type) SetRecur(b bool) { t.flags.set(typeRecur, b) }
Offset: BADWIDTH,
}
if typ == nil {
- f.SetBroke(true)
+ base.Fatalf("typ is nil")
}
return f
}
}
}
if anyBroke(methods) {
- t.SetBroke(true)
+ base.Fatalf("type contain broken method: %v", methods)
}
t.extra.(*Interface).pkg = pkg
t.extra.(*Interface).implicit = implicit
t := newType(TSTRUCT)
t.SetFields(fields)
if anyBroke(fields) {
- t.SetBroke(true)
+ base.Fatalf("struct contains broken field: %v", fields)
}
t.extra.(*Struct).pkg = pkg
if fieldsHasTParam(fields) {