public Surrogate typeToWrappedType() {
    { Surrogate self = this;

      if (((Stella_Class)(self.surrogateValue)) == null) {
        { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

          try {
            Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
            Stella.signalTranslationError();
            if (!(Stella.suppressWarningsP())) {
              Stella.printErrorContext(">> ERROR: ", Stella.STANDARD_ERROR);
              {
                Stella.STANDARD_ERROR.nativeStream.println();
                Stella.STANDARD_ERROR.nativeStream.println(" Can't find a class named `" + Stella_Object.deUglifyParseTree(self) + "'.");
              }
;
            }

          } finally {
            Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
          }
        }
        return (Stella.SGT_STELLA_UNKNOWN);
      }
      if (Surrogate.subtypeOfP(self, Stella.SGT_STELLA_OBJECT)) {
        return (self);
      }
      { Cons entry = null;
        Cons iter000 = Stella.$WRAPPED_TYPE_TABLE$;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          entry = ((Cons)(iter000.value));
          if (entry.rest.value == self) {
            return (((Surrogate)(entry.value)));
          }
        }
      }
      { Surrogate realtype = ((Stella_Class)(self.surrogateValue)).classType;

        if (!(self == realtype)) {
          { Cons entry = null;
            Cons iter001 = Stella.$WRAPPED_TYPE_TABLE$;

            for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
              entry = ((Cons)(iter001.value));
              if (entry.rest.value == realtype) {
                return (((Surrogate)(entry.value)));
              }
            }
          }
        }
      }
      return (null);
    }
  }