public static StandardObject baseTypeToTypeSpec(StandardObject self) {
    { Surrogate testValue000 = Stella_Object.safePrimaryType(self);

      if (Surrogate.subtypeOfSurrogateP(testValue000)) {
        { Surrogate self000 = ((Surrogate)(self));

          { Stella_Class renamed_Class = ((Stella_Class)(self000.surrogateValue));
            List parameters = renamed_Class.parameters();
            StandardObject parametertype = null;
            List parametertypes = null;

            if (parameters.nonEmptyP()) {
              parametertypes = List.newList();
              { Symbol parameter = null;
                Cons iter000 = parameters.theConsList;
                Cons collect000 = null;

                for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                  parameter = ((Symbol)(iter000.value));
                  parametertype = Stella_Class.lookupSlot(renamed_Class, parameter).computeReturnTypeSpec(self000);
                  if (Surrogate.unknownTypeP(((Surrogate)(parametertype)))) {
                    return (self000);
                  }
                  if (collect000 == null) {
                    {
                      collect000 = Cons.cons(parametertype, Stella.NIL);
                      if (parametertypes.theConsList == Stella.NIL) {
                        parametertypes.theConsList = collect000;
                      }
                      else {
                        Cons.addConsToEndOfConsList(parametertypes.theConsList, collect000);
                      }
                    }
                  }
                  else {
                    {
                      collect000.rest = Cons.cons(parametertype, Stella.NIL);
                      collect000 = collect000.rest;
                    }
                  }
                }
              }
              { ParametricTypeSpecifier self003 = ParametricTypeSpecifier.newParametricTypeSpecifier();

                self003.specifierBaseType = self000;
                self003.specifierParameterTypes = parametertypes;
                { ParametricTypeSpecifier value000 = self003;

                  return (value000);
                }
              }
            }
            return (self000);
          }
        }
      }
      else if (Surrogate.subtypeOfParametricTypeSpecifierP(testValue000)) {
        { ParametricTypeSpecifier self000 = ((ParametricTypeSpecifier)(self));

          return (self000);
        }
      }
      else {
        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

          stream000.nativeStream.print("base-type-to-type-spec: Not defined on `" + self + "'");
          throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
        }
      }
    }
  }