n = convlit1(n, t, false, context)
if n.Type() == nil {
- return n
+ base.Fatalf("cannot assign %v to %v", n, t)
+ }
+ if n.Type().IsUntyped() {
+ base.Fatalf("%L has untyped type", n)
}
if t.Kind() == types.TBLANK {
return n
}
-
- // Convert ideal bool from comparison to plain bool
- // if the next step is non-bool (like interface{}).
- if n.Type() == types.UntypedBool && !t.IsBoolean() {
- if n.Op() == ir.ONAME || n.Op() == ir.OLITERAL {
- r := ir.NewConvExpr(base.Pos, ir.OCONVNOP, nil, n)
- r.SetType(types.Types[types.TBOOL])
- r.SetTypecheck(1)
- r.SetImplicit(true)
- n = r
- }
- }
-
if types.Identical(n.Type(), t) {
return n
}