}
if !n.Diag() {
- if !t.Broke() {
- if explicit {
- base.Errorf("cannot convert %L to type %v", n, t)
- } else if context != nil {
- base.Errorf("cannot use %L as type %v in %s", n, t, context())
- } else {
- base.Errorf("cannot use %L as type %v", n, t)
- }
+ if explicit {
+ base.Errorf("cannot convert %L to type %v", n, t)
+ } else if context != nil {
+ base.Errorf("cannot use %L as type %v in %s", n, t, context())
+ } else {
+ base.Errorf("cannot use %L as type %v", n, t)
}
n.SetDiag(true)
}
+
n.SetType(nil)
return n
}
}
op, why := Convertop(n.X.Op() == ir.OLITERAL, t, n.Type())
if op == ir.OXXX {
- if !n.Diag() && !n.Type().Broke() && !n.X.Diag() {
+ if !n.Diag() && !n.X.Diag() {
base.Errorf("cannot convert %L to type %v%s", n.X, n.Type(), why)
n.SetDiag(true)
}
l = n.X
if l.Op() == ir.OTYPE {
if n.IsDDD {
- if !l.Type().Broke() {
- base.Errorf("invalid use of ... in type conversion to %v", l.Type())
- }
+ base.Errorf("invalid use of ... in type conversion to %v", l.Type())
n.SetDiag(true)
}
// type is broken or missing, most likely a method call on a broken type
// we will warn about the broken type elsewhere. no need to emit a potentially confusing error
- if n.Call.Type() == nil || n.Call.Type().Broke() {
+ if n.Call.Type() == nil {
return
}
// Convert node n for assignment to type t.
func assignconvfn(n ir.Node, t *types.Type, context func() string) ir.Node {
- if n == nil || n.Type() == nil || n.Type().Broke() {
+ if n == nil || n.Type() == nil {
return n
}
return ir.OCONVIFACE, ""
}
- // we'll have complained about this method anyway, suppress spurious messages.
- if have != nil && have.Sym == missing.Sym && (have.Type.Broke() || missing.Type.Broke()) {
- return ir.OCONVIFACE, ""
- }
-
var why string
if isptrto(src, types.TINTER) {
why = fmt.Sprintf(":\n\t%v is pointer to interface, not interface", src)
}
case top&ctxType == 0 && n.Op() == ir.OTYPE && t != nil:
- if !n.Type().Broke() {
- base.Errorf("type %v is not an expression", n.Type())
- n.SetDiag(true)
- }
+ base.Errorf("type %v is not an expression", n.Type())
+ n.SetDiag(true)
case top&(ctxStmt|ctxExpr) == ctxStmt && !isStmt && t != nil:
if !n.Diag() {
lno := base.Pos
defer func() { base.Pos = lno }()
- if tstruct.Broke() {
- return
- }
-
var n ir.Node
if len(nl) == 1 {
n = nl[0]
// If it returns ANOEQ, it also returns the component type of t that
// makes it incomparable.
func AlgType(t *Type) (AlgKind, *Type) {
- if t.Broke() {
- return AMEM, nil
- }
if t.Noalg() {
return ANOEQ, t
}
if t1 == t2 {
return true
}
- if t1 == nil || t2 == nil || t1.kind != t2.kind || t1.Broke() || t2.Broke() {
+ if t1 == nil || t2 == nil || t1.kind != t2.kind {
return false
}
if t1.sym != nil || t2.sym != nil {
}
func reportTypeLoop(t *Type) {
- if t.Broke() {
- return
- }
-
var l []*Type
if !findTypeLoop(t, &l) {
base.Fatalf("failed to find type loop for: %v", t)
}
if CalcSizeDisabled {
- if t.Broke() {
- // break infinite recursion from Fatal call below
- return
- }
t.SetBroke(true)
base.Fatalf("width not calculated: %v", t)
}
- // break infinite recursion if the broken recursive type
- // is referenced again
- if t.Broke() && t.width == 0 {
- return
- }
-
// defer CheckSize calls until after we're done
DeferCheckSize()
)
func (t *Type) NotInHeap() bool { return t.flags&typeNotInHeap != 0 }
-func (t *Type) Broke() bool { return false }
func (t *Type) Noalg() bool { return t.flags&typeNoalg != 0 }
func (t *Type) Deferwidth() bool { return t.flags&typeDeferwidth != 0 }
func (t *Type) Recur() bool { return t.flags&typeRecur != 0 }
if underlying.NotInHeap() {
t.SetNotInHeap(true)
}
- if underlying.Broke() {
- t.SetBroke(true)
- }
if underlying.HasTParam() {
t.SetHasTParam(true)
}
funargs := func(fields []*Field, funarg Funarg) *Type {
s := NewStruct(NoPkg, fields)
s.StructType().Funarg = funarg
- if s.Broke() {
- t.SetBroke(true)
- }
return s
}
// Can this type be stored directly in an interface word?
// Yes, if the representation is a single pointer.
func IsDirectIface(t *Type) bool {
- if t.Broke() {
- return false
- }
-
switch t.Kind() {
case TPTR:
// Pointers to notinheap types must be stored indirectly. See issue 42076.