@NotNull
 public static JetScope getFunctionInnerScope(
     @NotNull JetScope outerScope,
     @NotNull FunctionDescriptor descriptor,
     @NotNull BindingTrace trace) {
   WritableScope parameterScope =
       new WritableScopeImpl(
           outerScope,
           descriptor,
           new TraceBasedRedeclarationHandler(trace),
           "Function inner scope");
   ReceiverParameterDescriptor receiver = descriptor.getReceiverParameter();
   if (receiver != null) {
     parameterScope.setImplicitReceiver(receiver);
   }
   for (TypeParameterDescriptor typeParameter : descriptor.getTypeParameters()) {
     parameterScope.addTypeParameterDescriptor(typeParameter);
   }
   for (ValueParameterDescriptor valueParameterDescriptor : descriptor.getValueParameters()) {
     parameterScope.addVariableDescriptor(valueParameterDescriptor);
   }
   parameterScope.addLabeledDeclaration(descriptor);
   parameterScope.changeLockLevel(WritableScope.LockLevel.READING);
   return parameterScope;
 }
 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());
 }