@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 setTypeParameterDescriptors(@NotNull List<TypeParameterDescriptor> typeParameters) {
   if (this.typeParameters != null) {
     throw new IllegalStateException("Type parameters are already set for " + getName());
   }
   this.typeParameters = new ArrayList<TypeParameterDescriptor>(typeParameters);
   for (TypeParameterDescriptor typeParameterDescriptor : typeParameters) {
     scopeForSupertypeResolution.addTypeParameterDescriptor(typeParameterDescriptor);
   }
   scopeForSupertypeResolution.changeLockLevel(WritableScope.LockLevel.READING);
 }