// an error.
_, isCallExpr := m.(*ir.CallExpr)
_, isStructKeyExpr := m.(*ir.StructKeyExpr)
- if !isCallExpr && !isStructKeyExpr && x.Op() != ir.OPANIC &&
+ _, isKeyExpr := m.(*ir.KeyExpr)
+ if !isCallExpr && !isStructKeyExpr && !isKeyExpr && x.Op() != ir.OPANIC &&
x.Op() != ir.OCLOSE {
base.Fatalf(fmt.Sprintf("Nil type for %v", x))
}
}
}
- case ir.OMETHVALUE:
+ case ir.OMETHVALUE, ir.OMETHEXPR:
// Redo the transformation of OXDOT, now that we
// know the method value is being called. Then
// transform the call.
func (r *importReader) typ() *types.Type {
// If this is a top-level type call, defer type instantiations until the
// type is fully constructed.
+ types.DeferCheckSize()
deferDoInst()
t := r.p.typAt(r.uint64())
resumeDoInst()
+ types.ResumeCheckSize()
return t
}
b.WriteString(targ.Sym().Pkg.Name)
b.WriteByte('.')
}
- b.WriteString(targ.String())
+ // types1 uses "interface {" and types2 uses "interface{" - convert
+ // to consistent types2 format.
+ tstring := targ.String()
+ tstring = strings.Replace(tstring, "interface {", "interface{", -1)
+ b.WriteString(tstring)
}
b.WriteByte(']')
return b.String()
b.WriteString(targ.Sym().Pkg.Name)
b.WriteByte('.')
}
- b.WriteString(targ.String())
+ // types1 uses "interface {" and types2 uses "interface{" - convert
+ // to consistent types2 format.
+ tstring := targ.String()
+ tstring = strings.Replace(tstring, "interface {", "interface{", -1)
+ b.WriteString(tstring)
}
b.WriteString("]")
if i >= 0 {
} else {
assert(false)
}
+ case types.TINT, types.TINT8, types.TINT16, types.TINT32, types.TINT64,
+ types.TUINT, types.TUINT8, types.TUINT16, types.TUINT32, types.TUINT64,
+ types.TUINTPTR, types.TBOOL, types.TSTRING:
+ newt = t.Underlying()
}
if newt == nil {
// Even though there were typeparams in the type, there may be no
continue
}
- // Once we go to 1.18, then embedded types can be anything, but
- // for now, just interfaces and unions.
+ // In 1.18, embedded types can be anything. In Go 1.17, we disallow
+ // embedding anything other than interfaces.
if !m.Type.IsInterface() {
+ 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)
"typeparam/nested.go", // -G=3 doesn't support function-local types with generics
- "typeparam/mdempsky/1.go",
- "typeparam/mdempsky/2.go",
- "typeparam/mdempsky/3.go",
- "typeparam/mdempsky/4.go",
- "typeparam/mdempsky/5.go",
- "typeparam/mdempsky/9.go",
- "typeparam/mdempsky/11.go",
- "typeparam/mdempsky/12.go",
- "typeparam/mdempsky/13.go",
+ "typeparam/mdempsky/4.go", // -G=3 can't export functions with labeled breaks in loops
+ "typeparam/mdempsky/11.go", // types2/noder2 should give conversion error, because of "notinheap" mismatch
)
var unifiedFailures = setOf(