Example #1
0
 private void resolvePropertyInitializer(
     JetProperty property,
     PropertyDescriptor propertyDescriptor,
     JetExpression initializer,
     JetScope scope) {
   // JetFlowInformationProvider flowInformationProvider =
   // context.getDescriptorResolver().computeFlowData(property, initializer); // TODO : flow JET-15
   JetType expectedTypeForInitializer =
       property.getPropertyTypeRef() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
   JetType type =
       expressionTypingServices.getType(
           descriptorResolver.getPropertyDeclarationInnerScope(
               scope,
               propertyDescriptor,
               propertyDescriptor.getTypeParameters(),
               propertyDescriptor.getReceiverParameter(),
               trace),
           initializer,
           expectedTypeForInitializer,
           trace);
   //
   //        JetType expectedType = propertyDescriptor.getInType();
   //        if (expectedType == null) {
   //            expectedType = propertyDescriptor.getType();
   //        }
   //        if (type != null && expectedType != null
   //            && !context.getSemanticServices().getTypeChecker().isSubtypeOf(type,
   // expectedType)) {
   ////            trace.report(TYPE_MISMATCH.on(initializer, expectedType, type));
   //        }
 }
Example #2
0
  private void renderProperty(
      @NotNull PropertyDescriptor property, @NotNull StringBuilder builder) {
    if (!startFromName) {
      renderAnnotations(property, builder);
      renderVisibility(property.getVisibility(), builder);
      renderModalityForCallable(property, builder);
      renderOverride(property, builder);
      renderMemberKind(property, builder);

      renderValVarPrefix(property, builder);
    }

    renderTypeParameters(property.getTypeParameters(), builder, true);

    ReceiverParameterDescriptor receiver = property.getReceiverParameter();
    if (receiver != null) {
      builder.append(escape(renderType(receiver.getType()))).append(".");
    }
    renderName(property, builder);
    builder.append(": ").append(escape(renderType(property.getType())));

    renderWhereSuffix(property.getTypeParameters(), builder);
  }