public void createTypeConstructor() {
   assert typeConstructor == null : typeConstructor;
   this.typeConstructor =
       TypeConstructorImpl.createForClass(
           this,
           Annotations.EMPTY, // TODO : pass annotations from the class?
           !getModality().isOverridable(),
           getName().asString(),
           typeParameters,
           supertypes);
   for (FunctionDescriptor functionDescriptor : getConstructors()) {
     ((ConstructorDescriptorImpl) functionDescriptor).setReturnType(getDefaultType());
   }
   scopeForMemberResolution.setImplicitReceiver(getThisAsReceiverParameter());
 }
  public void setPrimaryConstructor(@NotNull ConstructorDescriptor constructorDescriptor) {
    assert primaryConstructor == null : "Primary constructor assigned twice " + this;
    primaryConstructor = constructorDescriptor;

    constructors.add(constructorDescriptor);

    ((ConstructorDescriptorImpl) constructorDescriptor)
        .setReturnType(
            new DelegatingType() {
              @Override
              protected JetType getDelegate() {
                return getDefaultType();
              }
            });

    if (constructorDescriptor.isPrimary()) {
      setUpScopeForInitializers(constructorDescriptor);
    }
  }