return false
}
-var errorInterface *types.Type // lazily initialized
-
func (p *exporter) typ(t *types.Type) {
if t == nil {
Fatalf("exporter: nil type")
p.qualifiedName(tsym)
// write underlying type
- orig := t.Orig
- if orig == types.Errortype {
- // The error type is the only predeclared type which has
- // a composite underlying type. When we encode that type,
- // make sure to encode the underlying interface rather than
- // the named type again. See also the comment in universe.go
- // regarding the errortype and issue #15920.
- if errorInterface == nil {
- errorInterface = makeErrorInterface()
- }
- orig = errorInterface
- }
- p.typ(orig)
+ p.typ(t.Orig)
// interfaces don't have associated methods
if t.Orig.IsInterface() {
s := builtinpkg.Lookup("error")
types.Errortype = makeErrorInterface()
types.Errortype.Sym = s
- // TODO: If we can prove that it's safe to set errortype.Orig here
- // than we don't need the special errortype/errorInterface case in
- // bexport.go. See also issue #15920.
- // errortype.Orig = makeErrorInterface()
+ types.Errortype.Orig = makeErrorInterface()
s.Def = asTypesNode(typenod(types.Errortype))
// We create separate byte and rune types for better error messages