Пример #1
0
 @NotNull
 public KotlinType getEnumType(@NotNull KotlinType argument) {
   Variance projectionType = Variance.INVARIANT;
   List<TypeProjectionImpl> types =
       Collections.singletonList(new TypeProjectionImpl(projectionType, argument));
   return KotlinTypeImpl.create(Annotations.Companion.getEMPTY(), getEnum(), false, types);
 }
Пример #2
0
 @NotNull
 public static KotlinType makeUnsubstitutedType(
     ClassDescriptor classDescriptor, MemberScope unsubstitutedMemberScope) {
   if (ErrorUtils.isError(classDescriptor)) {
     return ErrorUtils.createErrorType("Unsubstituted type for " + classDescriptor);
   }
   TypeConstructor typeConstructor = classDescriptor.getTypeConstructor();
   List<TypeProjection> arguments = getDefaultTypeProjections(typeConstructor.getParameters());
   return KotlinTypeImpl.create(
       Annotations.Companion.getEMPTY(),
       typeConstructor,
       false,
       arguments,
       unsubstitutedMemberScope);
 }
Пример #3
0
  @NotNull
  public KotlinType getFunctionType(
      @NotNull Annotations annotations,
      @Nullable KotlinType receiverType,
      @NotNull List<KotlinType> parameterTypes,
      @NotNull KotlinType returnType) {
    List<TypeProjection> arguments =
        getFunctionTypeArgumentProjections(receiverType, parameterTypes, returnType);
    int size = parameterTypes.size();
    ClassDescriptor classDescriptor =
        receiverType == null ? getFunction(size) : getExtensionFunction(size);

    Annotations typeAnnotations =
        receiverType == null ? annotations : addExtensionFunctionTypeAnnotation(annotations);

    return KotlinTypeImpl.create(typeAnnotations, classDescriptor, false, arguments);
  }