예제 #1
0
  public static boolean shouldRecordInitializerForProperty(
      @NotNull VariableDescriptor variable, @NotNull KotlinType type) {
    if (variable.isVar() || type.isError()) return false;

    if (TypeUtils.acceptsNullable(type)) return true;

    KotlinBuiltIns builtIns = getBuiltIns(variable);
    return KotlinBuiltIns.isPrimitiveType(type)
        || KotlinTypeChecker.DEFAULT.equalTypes(builtIns.getStringType(), type)
        || KotlinTypeChecker.DEFAULT.equalTypes(builtIns.getNumber().getDefaultType(), type)
        || KotlinTypeChecker.DEFAULT.equalTypes(builtIns.getAnyType(), type);
  }
예제 #2
0
 @NotNull
 public static KotlinType getPrimitiveNumberType(
     @NotNull IntegerValueTypeConstructor numberValueTypeConstructor,
     @NotNull KotlinType expectedType) {
   if (noExpectedType(expectedType) || expectedType.isError()) {
     return getDefaultPrimitiveNumberType(numberValueTypeConstructor);
   }
   for (KotlinType primitiveNumberType : numberValueTypeConstructor.getSupertypes()) {
     if (KotlinTypeChecker.DEFAULT.isSubtypeOf(primitiveNumberType, expectedType)) {
       return primitiveNumberType;
     }
   }
   return getDefaultPrimitiveNumberType(numberValueTypeConstructor);
 }
예제 #3
0
 @Override
 public boolean isError() {
   return delegate.isError();
 }