Пример #1
0
 private void checkValOnAnnotationParameter(JetClass aClass) {
   for (JetParameter parameter : aClass.getPrimaryConstructorParameters()) {
     if (!parameter.hasValOrVar()) {
       trace.report(MISSING_VAL_ON_ANNOTATION_PARAMETER.on(parameter));
     }
   }
 }
 private static String renderParameter(
     ValueParameterDescriptor descriptor, boolean named, BindingContext bindingContext) {
   StringBuilder builder = new StringBuilder();
   if (named) builder.append("[");
   if (descriptor.getVarargElementType() != null) {
     builder.append("vararg ");
   }
   builder
       .append(descriptor.getName())
       .append(": ")
       .append(DescriptorRenderer.TEXT.renderType(getActualParameterType(descriptor)));
   if (descriptor.hasDefaultValue()) {
     PsiElement element = BindingContextUtils.descriptorToDeclaration(bindingContext, descriptor);
     String defaultExpression = "?";
     if (element instanceof JetParameter) {
       JetParameter parameter = (JetParameter) element;
       JetExpression defaultValue = parameter.getDefaultValue();
       if (defaultValue != null) {
         if (defaultValue instanceof JetConstantExpression) {
           JetConstantExpression constantExpression = (JetConstantExpression) defaultValue;
           defaultExpression = constantExpression.getText();
           if (defaultExpression.length() > 10) {
             if (defaultExpression.startsWith("\"")) defaultExpression = "\"...\"";
             else if (defaultExpression.startsWith("\'")) defaultExpression = "\'...\'";
             else defaultExpression = defaultExpression.substring(0, 7) + "...";
           }
         }
       }
     }
     builder.append(" = ").append(defaultExpression);
   }
   if (named) builder.append("]");
   return builder.toString();
 }
Пример #3
0
  private void processPrimaryConstructor(
      @NotNull TopDownAnalysisContext c,
      @NotNull MutableClassDescriptor classDescriptor,
      @NotNull JetClass klass) {
    // TODO : not all the parameters are real properties
    JetScope memberScope = classDescriptor.getScopeForClassHeaderResolution();
    ConstructorDescriptor constructorDescriptor =
        descriptorResolver.resolvePrimaryConstructorDescriptor(
            memberScope, classDescriptor, klass, trace);
    if (constructorDescriptor != null) {
      List<ValueParameterDescriptor> valueParameterDescriptors =
          constructorDescriptor.getValueParameters();
      List<JetParameter> primaryConstructorParameters = klass.getPrimaryConstructorParameters();
      assert valueParameterDescriptors.size() == primaryConstructorParameters.size();
      List<ValueParameterDescriptor> notProperties = new ArrayList<ValueParameterDescriptor>();
      for (ValueParameterDescriptor valueParameterDescriptor : valueParameterDescriptors) {
        JetParameter parameter =
            primaryConstructorParameters.get(valueParameterDescriptor.getIndex());
        if (parameter.getValOrVarNode() != null) {
          PropertyDescriptor propertyDescriptor =
              descriptorResolver.resolvePrimaryConstructorParameterToAProperty(
                  classDescriptor, valueParameterDescriptor, memberScope, parameter, trace);
          classDescriptor.getBuilder().addPropertyDescriptor(propertyDescriptor);
          c.getPrimaryConstructorParameterProperties().put(parameter, propertyDescriptor);
        } else {
          notProperties.add(valueParameterDescriptor);
        }
      }

      if (classDescriptor.getKind() != ClassKind.TRAIT) {
        classDescriptor.setPrimaryConstructor(constructorDescriptor);
        classDescriptor.addConstructorParametersToInitializersScope(notProperties);
      }
    }
  }
Пример #4
0
  private void processPrimaryConstructor(MutableClassDescriptor classDescriptor, JetClass klass) {
    if (classDescriptor.getKind() == ClassKind.TRAIT) {
      JetParameterList primaryConstructorParameterList = klass.getPrimaryConstructorParameterList();
      if (primaryConstructorParameterList != null) {
        context.getTrace().report(CONSTRUCTOR_IN_TRAIT.on(primaryConstructorParameterList));
      }
      if (!klass.hasPrimaryConstructor()) return;
    }

    // TODO : not all the parameters are real properties
    JetScope memberScope = classDescriptor.getScopeForSupertypeResolution();
    ConstructorDescriptor constructorDescriptor =
        context
            .getDescriptorResolver()
            .resolvePrimaryConstructorDescriptor(memberScope, classDescriptor, klass);
    for (JetParameter parameter : klass.getPrimaryConstructorParameters()) {
      if (parameter.getValOrVarNode() != null) {
        PropertyDescriptor propertyDescriptor =
            context
                .getDescriptorResolver()
                .resolvePrimaryConstructorParameterToAProperty(
                    classDescriptor, memberScope, parameter);
        classDescriptor.addPropertyDescriptor(propertyDescriptor);
        context.getPrimaryConstructorParameterProperties().add(propertyDescriptor);
      }
    }
    if (constructorDescriptor != null) {
      classDescriptor.setPrimaryConstructor(constructorDescriptor, context.getTrace());
    }
  }
  private List<ValueParameterDescriptor> createValueParameterDescriptors(
      ExpressionTypingContext context,
      JetFunctionLiteral functionLiteral,
      FunctionDescriptorImpl functionDescriptor,
      boolean functionTypeExpected) {
    List<ValueParameterDescriptor> valueParameterDescriptors = Lists.newArrayList();
    List<JetParameter> declaredValueParameters = functionLiteral.getValueParameters();

    List<ValueParameterDescriptor> expectedValueParameters =
        (functionTypeExpected)
            ? JetStandardClasses.getValueParameters(functionDescriptor, context.expectedType)
            : null;

    boolean hasDeclaredValueParameters = functionLiteral.getValueParameterList() != null;
    if (functionTypeExpected
        && !hasDeclaredValueParameters
        && expectedValueParameters.size() == 1) {
      ValueParameterDescriptor valueParameterDescriptor = expectedValueParameters.get(0);
      ValueParameterDescriptor it =
          new ValueParameterDescriptorImpl(
              functionDescriptor,
              0,
              Collections.<AnnotationDescriptor>emptyList(),
              "it",
              false,
              valueParameterDescriptor.getOutType(),
              valueParameterDescriptor.hasDefaultValue(),
              valueParameterDescriptor.getVarargElementType());
      valueParameterDescriptors.add(it);
      context.trace.record(AUTO_CREATED_IT, it);
    } else {
      for (int i = 0; i < declaredValueParameters.size(); i++) {
        JetParameter declaredParameter = declaredValueParameters.get(i);
        JetTypeReference typeReference = declaredParameter.getTypeReference();

        JetType type;
        if (typeReference != null) {
          type = context.getTypeResolver().resolveType(context.scope, typeReference);
        } else {
          if (expectedValueParameters != null && i < expectedValueParameters.size()) {
            type = expectedValueParameters.get(i).getOutType();
          } else {
            context.trace.report(CANNOT_INFER_PARAMETER_TYPE.on(declaredParameter));
            type = ErrorUtils.createErrorType("Cannot be inferred");
          }
        }
        ValueParameterDescriptor valueParameterDescriptor =
            context
                .getDescriptorResolver()
                .resolveValueParameterDescriptor(functionDescriptor, declaredParameter, i, type);
        valueParameterDescriptors.add(valueParameterDescriptor);
      }
    }
    return valueParameterDescriptors;
  }
Пример #6
0
  @Nullable
  public static JetClass getClassIfParameterIsProperty(@NotNull JetParameter jetParameter) {
    if (jetParameter.getValOrVarNode() != null) {
      PsiElement parent = jetParameter.getParent();
      if (parent instanceof JetParameterList && parent.getParent() instanceof JetClass) {
        return (JetClass) parent.getParent();
      }
    }

    return null;
  }
Пример #7
0
 public static boolean isFunctionLiteralWithoutDeclaredParameterTypes(
     @Nullable JetExpression expression) {
   if (!(expression instanceof JetFunctionLiteralExpression)) return false;
   JetFunctionLiteralExpression functionLiteral = (JetFunctionLiteralExpression) expression;
   for (JetParameter parameter : functionLiteral.getValueParameters()) {
     if (parameter.getTypeReference() != null) {
       return false;
     }
   }
   return true;
 }
Пример #8
0
  @Override
  public Icon getIcon(@NotNull PsiElement psiElement, int flags) {
    if (psiElement instanceof JetFile) {
      JetFile file = (JetFile) psiElement;
      JetClassOrObject mainClass = getMainClass(file);
      return mainClass != null ? getIcon(mainClass, flags) : JetIcons.FILE;
    }
    if (psiElement instanceof JetNamespaceHeader) {
      return (flags & Iconable.ICON_FLAG_OPEN) != 0
          ? PlatformIcons.PACKAGE_OPEN_ICON
          : PlatformIcons.PACKAGE_ICON;
    }
    if (psiElement instanceof JetNamedFunction) {
      return PsiTreeUtil.getParentOfType(psiElement, JetNamedDeclaration.class) instanceof JetClass
          ? PlatformIcons.METHOD_ICON
          : JetIcons.FUNCTION;
    }
    if (psiElement instanceof JetClass) {
      JetClass jetClass = (JetClass) psiElement;
      if (jetClass.isTrait()) {
        return JetIcons.TRAIT;
      }

      Icon icon =
          jetClass.hasModifier(JetTokens.ENUM_KEYWORD) ? PlatformIcons.ENUM_ICON : JetIcons.CLASS;
      if (jetClass instanceof JetEnumEntry) {
        JetEnumEntry enumEntry = (JetEnumEntry) jetClass;
        if (enumEntry.getPrimaryConstructorParameterList() == null) {
          icon = PlatformIcons.ENUM_ICON;
        }
      }
      return icon;
    }
    if (psiElement instanceof JetObjectDeclaration || psiElement instanceof JetClassObject) {
      return JetIcons.OBJECT;
    }
    if (psiElement instanceof JetParameter) {
      JetParameter parameter = (JetParameter) psiElement;
      if (parameter.getValOrVarNode() != null) {
        JetParameterList parameterList =
            PsiTreeUtil.getParentOfType(psiElement, JetParameterList.class);
        if (parameterList != null && parameterList.getParent() instanceof JetClass) {
          return parameter.isMutable() ? JetIcons.FIELD_VAR : JetIcons.FIELD_VAL;
        }
      }
      return JetIcons.PARAMETER;
    }
    if (psiElement instanceof JetProperty) {
      JetProperty property = (JetProperty) psiElement;
      return property.isVar() ? JetIcons.FIELD_VAR : JetIcons.FIELD_VAL;
    }
    return null;
  }
Пример #9
0
 private void checkDefaultParameterValues(
     List<JetParameter> valueParameters,
     List<ValueParameterDescriptor> valueParameterDescriptors,
     JetScope declaringScope) {
   for (int i = 0; i < valueParameters.size(); i++) {
     ValueParameterDescriptor valueParameterDescriptor = valueParameterDescriptors.get(i);
     if (valueParameterDescriptor.hasDefaultValue()) {
       JetParameter jetParameter = valueParameters.get(i);
       JetExpression defaultValue = jetParameter.getDefaultValue();
       if (defaultValue != null) {
         expressionTypingServices.getType(
             declaringScope, defaultValue, valueParameterDescriptor.getType(), trace);
       }
     }
   }
 }
  @NotNull
  private static ValueParameterDescriptor createValueParameterDescriptor(
      @NotNull ExpressionTypingContext context,
      @NotNull FunctionDescriptorImpl functionDescriptor,
      @NotNull List<JetParameter> declaredValueParameters,
      @Nullable List<ValueParameterDescriptor> expectedValueParameters,
      int index) {
    JetParameter declaredParameter = declaredValueParameters.get(index);
    JetTypeReference typeReference = declaredParameter.getTypeReference();

    JetType expectedType;
    if (expectedValueParameters != null && index < expectedValueParameters.size()) {
      expectedType = expectedValueParameters.get(index).getType();
    } else {
      expectedType = null;
    }
    JetType type;
    if (typeReference != null) {
      type =
          context
              .expressionTypingServices
              .getTypeResolver()
              .resolveType(context.scope, typeReference, context.trace, true);
      if (expectedType != null) {
        if (!JetTypeChecker.INSTANCE.isSubtypeOf(expectedType, type)) {
          context.trace.report(
              EXPECTED_PARAMETER_TYPE_MISMATCH.on(declaredParameter, expectedType));
        }
      }
    } else {
      if (expectedType == null
          || expectedType == DONT_CARE
          || expectedType == CANT_INFER_TYPE_PARAMETER) {
        context.trace.report(CANNOT_INFER_PARAMETER_TYPE.on(declaredParameter));
      }
      if (expectedType != null) {
        type = expectedType;
      } else {
        type = CANT_INFER_LAMBDA_PARAM_TYPE;
      }
    }
    return context
        .expressionTypingServices
        .getDescriptorResolver()
        .resolveValueParameterDescriptorWithAnnotationArguments(
            context.scope, functionDescriptor, declaredParameter, index, type, context.trace);
  }
  private void changeParameter(
      int parameterIndex, JetParameter parameter, JetParameterInfo parameterInfo) {
    ASTNode valOrVarAstNode = parameter.getValOrVarNode();
    PsiElement valOrVarNode = valOrVarAstNode != null ? valOrVarAstNode.getPsi() : null;
    JetValVar valOrVar = parameterInfo.getValOrVar();

    JetPsiFactory psiFactory = JetPsiFactory(getProject());
    if (valOrVarNode != null) {
      if (valOrVar == JetValVar.None) {
        valOrVarNode.delete();
      } else {
        valOrVarNode.replace(psiFactory.createValOrVarNode(valOrVar.toString()).getPsi());
      }
    } else if (valOrVar != JetValVar.None) {
      PsiElement firstChild = parameter.getFirstChild();
      parameter.addBefore(psiFactory.createValOrVarNode(valOrVar.toString()).getPsi(), firstChild);
      parameter.addBefore(psiFactory.createWhiteSpace(), firstChild);
    }

    if (parameterInfo.getIsTypeChanged() && parameter.getTypeReference() != null) {
      String renderedType = parameterInfo.renderType(parameterIndex, this);
      parameter.setTypeReference(psiFactory.createType(renderedType));
    }

    PsiElement identifier = parameter.getNameIdentifier();

    if (identifier != null) {
      //noinspection unchecked
      String newName =
          parameterInfo.getInheritedName((JetFunctionDefinitionUsage<PsiElement>) this);
      identifier.replace(psiFactory.createIdentifier(newName));
    }
  }
Пример #12
0
 private void generatePrimaryConstructorProperties(
     PropertyCodegen propertyCodegen, JetClassOrObject origin) {
   boolean isAnnotation = origin instanceof JetClass && ((JetClass) origin).isAnnotation();
   for (JetParameter p : getPrimaryConstructorParameters()) {
     if (p.getValOrVarNode() != null) {
       PropertyDescriptor propertyDescriptor =
           state.getBindingContext().get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, p);
       if (propertyDescriptor != null) {
         if (!isAnnotation) {
           propertyCodegen.generatePrimaryConstructorProperty(p, propertyDescriptor);
         } else {
           Type type = state.getTypeMapper().mapType(propertyDescriptor);
           v.newMethod(
               p, ACC_PUBLIC | ACC_ABSTRACT, p.getName(), "()" + type.getDescriptor(), null, null);
         }
       }
     }
   }
 }
Пример #13
0
 public void checkParameterHasNoValOrVar(
     @NotNull JetParameter parameter,
     @NotNull DiagnosticFactory1<PsiElement, JetKeywordToken> diagnosticFactory) {
   PsiElement valOrVar = parameter.getValOrVarKeyword();
   if (valOrVar != null) {
     trace.report(
         diagnosticFactory.on(
             valOrVar, ((JetKeywordToken) valOrVar.getNode().getElementType())));
   }
 }
Пример #14
0
 @Override
 public Boolean computeValue(
     SlicedMap map,
     PropertyDescriptor propertyDescriptor,
     Boolean backingFieldRequired,
     boolean valueNotFound) {
   if (propertyDescriptor.getKind() != CallableMemberDescriptor.Kind.DECLARATION) {
     return false;
   }
   backingFieldRequired = valueNotFound ? false : backingFieldRequired;
   assert backingFieldRequired != null;
   // TODO: user BindingContextAccessors
   PsiElement declarationPsiElement =
       map.get(BindingContextUtils.DESCRIPTOR_TO_DECLARATION, propertyDescriptor);
   if (declarationPsiElement instanceof JetParameter) {
     JetParameter jetParameter = (JetParameter) declarationPsiElement;
     return jetParameter.getValOrVarNode() != null
         || backingFieldRequired; // this part is unused because we do not allow access to
                                  // constructor parameters in member bodies
   }
   if (propertyDescriptor.getModality() == Modality.ABSTRACT) return false;
   PropertyGetterDescriptor getter = propertyDescriptor.getGetter();
   PropertySetterDescriptor setter = propertyDescriptor.getSetter();
   if (getter == null) {
     return true;
   } else if (propertyDescriptor.isVar() && setter == null) {
     return true;
   } else if (setter != null
       && !setter.hasBody()
       && setter.getModality() != Modality.ABSTRACT) {
     return true;
   } else if (!getter.hasBody() && getter.getModality() != Modality.ABSTRACT) {
     return true;
   }
   return backingFieldRequired;
 }
Пример #15
0
  public static Icon getBaseIcon(PsiElement psiElement) {
    if (psiElement instanceof JetNamespaceHeader) {
      return PlatformIcons.PACKAGE_ICON;
    }

    if (psiElement instanceof KotlinLightClassForPackage) {
      return JetIcons.FILE;
    }

    if (psiElement instanceof KotlinLightClassForExplicitDeclaration) {
      psiElement = psiElement.getNavigationElement();
    }

    if (psiElement instanceof JetNamedFunction) {
      if (((JetFunction) psiElement).getReceiverTypeRef() != null) {
        return JetIcons.EXTENSION_FUNCTION;
      }

      if (PsiTreeUtil.getParentOfType(psiElement, JetNamedDeclaration.class) instanceof JetClass) {
        if (JetPsiUtil.isAbstract((JetFunction) psiElement)) {
          return PlatformIcons.ABSTRACT_METHOD_ICON;
        } else {
          return PlatformIcons.METHOD_ICON;
        }
      } else {
        return JetIcons.FUNCTION;
      }
    }
    if (psiElement instanceof JetClass) {
      JetClass jetClass = (JetClass) psiElement;
      if (jetClass.isTrait()) {
        return JetIcons.TRAIT;
      }

      Icon icon = jetClass.isEnum() ? PlatformIcons.ENUM_ICON : JetIcons.CLASS;
      if (jetClass instanceof JetEnumEntry) {
        JetEnumEntry enumEntry = (JetEnumEntry) jetClass;
        if (enumEntry.getPrimaryConstructorParameterList() == null) {
          icon = PlatformIcons.ENUM_ICON;
        }
      }
      return icon;
    }
    if (psiElement instanceof JetObjectDeclaration || psiElement instanceof JetClassObject) {
      return JetIcons.OBJECT;
    }
    if (psiElement instanceof JetParameter) {
      JetParameter parameter = (JetParameter) psiElement;
      if (parameter.getValOrVarNode() != null) {
        JetParameterList parameterList =
            PsiTreeUtil.getParentOfType(psiElement, JetParameterList.class);
        if (parameterList != null && parameterList.getParent() instanceof JetClass) {
          return parameter.isMutable() ? JetIcons.FIELD_VAR : JetIcons.FIELD_VAL;
        }
      }
      return JetIcons.PARAMETER;
    }
    if (psiElement instanceof JetProperty) {
      JetProperty property = (JetProperty) psiElement;
      return property.isVar() ? JetIcons.FIELD_VAR : JetIcons.FIELD_VAL;
    }

    return null;
  }
  private void computeValueParameters(
      @NotNull List<ValueParameterDescriptor> parameterDescriptors) {
    if (parameterDescriptors.size() != altFunDeclaration.getValueParameters().size()) {
      throw new AlternativeSignatureMismatchException(
          "Method signature has %d value parameters, but alternative signature has %d",
          parameterDescriptors.size(), altFunDeclaration.getValueParameters().size());
    }

    List<ValueParameterDescriptor> altParamDescriptors = new ArrayList<ValueParameterDescriptor>();
    for (int i = 0, size = parameterDescriptors.size(); i < size; i++) {
      ValueParameterDescriptor originalParameterDescriptor = parameterDescriptors.get(i);
      JetParameter annotationValueParameter = altFunDeclaration.getValueParameters().get(i);

      //noinspection ConstantConditions
      JetTypeElement alternativeTypeElement =
          annotationValueParameter.getTypeReference().getTypeElement();
      assert alternativeTypeElement != null;

      JetType alternativeType;
      JetType alternativeVarargElementType;

      JetType originalParamVarargElementType = originalParameterDescriptor.getVarargElementType();
      if (originalParamVarargElementType == null) {
        if (annotationValueParameter.isVarArg()) {
          throw new AlternativeSignatureMismatchException(
              "Parameter in method signature is not vararg, but in alternative signature it is vararg");
        }

        alternativeType =
            TypeTransformingVisitor.computeType(
                alternativeTypeElement,
                originalParameterDescriptor.getType(),
                originalToAltTypeParameters,
                MEMBER_SIGNATURE_CONTRAVARIANT);
        alternativeVarargElementType = null;
      } else {
        if (!annotationValueParameter.isVarArg()) {
          throw new AlternativeSignatureMismatchException(
              "Parameter in method signature is vararg, but in alternative signature it is not");
        }

        alternativeVarargElementType =
            TypeTransformingVisitor.computeType(
                alternativeTypeElement, originalParamVarargElementType,
                originalToAltTypeParameters, MEMBER_SIGNATURE_CONTRAVARIANT);
        alternativeType = KotlinBuiltIns.getInstance().getArrayType(alternativeVarargElementType);
      }

      Name altName = annotationValueParameter.getNameAsName();

      altParamDescriptors.add(
          new ValueParameterDescriptorImpl(
              originalParameterDescriptor.getContainingDeclaration(),
              null,
              originalParameterDescriptor.getIndex(),
              originalParameterDescriptor.getAnnotations(),
              altName != null ? altName : originalParameterDescriptor.getName(),
              alternativeType,
              originalParameterDescriptor.declaresDefaultValue(),
              alternativeVarargElementType));
    }

    altValueParameters = altParamDescriptors;
  }
Пример #17
0
  public void resolveFunctionBody(
      @NotNull DataFlowInfo outerDataFlowInfo,
      @NotNull BindingTrace trace,
      @NotNull JetDeclarationWithBody function,
      @NotNull FunctionDescriptor functionDescriptor,
      @NotNull LexicalScope scope,
      @Nullable Function1<LexicalScope, DataFlowInfo> beforeBlockBody,
      @NotNull CallChecker callChecker) {
    LexicalScope innerScope =
        FunctionDescriptorUtil.getFunctionInnerScope(scope, functionDescriptor, trace);
    List<JetParameter> valueParameters = function.getValueParameters();
    List<ValueParameterDescriptor> valueParameterDescriptors =
        functionDescriptor.getValueParameters();

    valueParameterResolver.resolveValueParameters(
        valueParameters,
        valueParameterDescriptors,
        ExpressionTypingContext.newContext(
            trace, innerScope, outerDataFlowInfo, NO_EXPECTED_TYPE, callChecker));

    // Synthetic "field" creation
    if (functionDescriptor instanceof PropertyAccessorDescriptor) {
      PropertyAccessorDescriptor accessorDescriptor =
          (PropertyAccessorDescriptor) functionDescriptor;
      JetProperty property = (JetProperty) function.getParent();
      final SyntheticFieldDescriptor fieldDescriptor =
          new SyntheticFieldDescriptor(accessorDescriptor, property);
      innerScope =
          new LexicalScopeImpl(
              innerScope,
              functionDescriptor,
              true,
              functionDescriptor.getExtensionReceiverParameter(),
              "Accessor inner scope with synthetic field",
              RedeclarationHandler.DO_NOTHING,
              new Function1<LexicalScopeImpl.InitializeHandler, Unit>() {
                @Override
                public Unit invoke(LexicalScopeImpl.InitializeHandler handler) {
                  handler.addVariableOrClassDescriptor(fieldDescriptor);
                  return Unit.INSTANCE$;
                }
              });
      // Check parameter name shadowing
      for (JetParameter parameter : function.getValueParameters()) {
        if (SyntheticFieldDescriptor.NAME.equals(parameter.getNameAsName())) {
          trace.report(Errors.ACCESSOR_PARAMETER_NAME_SHADOWING.on(parameter));
        }
      }
    }

    DataFlowInfo dataFlowInfo = null;

    if (beforeBlockBody != null) {
      dataFlowInfo = beforeBlockBody.invoke(innerScope);
    }

    if (function.hasBody()) {
      expressionTypingServices.checkFunctionReturnType(
          innerScope,
          function,
          functionDescriptor,
          dataFlowInfo != null ? dataFlowInfo : outerDataFlowInfo,
          null,
          trace);
    }

    assert functionDescriptor.getReturnType() != null;
  }