예제 #1
0
 @Override
 public void visitTypeVariable(String name, boolean nullable) {
   JetType r =
       TypeUtils.makeNullableAsSpecified(
           typeVariableResolver.getTypeVariable(name).getDefaultType(), nullable);
   done(r);
 }
예제 #2
0
  @NotNull
  public TypeReconstructionResult reconstruct(@NotNull JetType subjectType) {
    if (!isBare()) return new TypeReconstructionResult(getActualType(), true);

    TypeReconstructionResult reconstructionResult =
        CastDiagnosticsUtil.findStaticallyKnownSubtype(
            TypeUtils.makeNotNullable(subjectType), getBareTypeConstructor());
    JetType type = reconstructionResult.getResultingType();
    // No need to make an absent type nullable
    if (type == null) return reconstructionResult;

    JetType resultingType = TypeUtils.makeNullableAsSpecified(type, isBareTypeNullable());
    return new TypeReconstructionResult(
        resultingType, reconstructionResult.isAllArgumentsInferred());
  }
 @NotNull
 private static JetType getFunctionTypeForSamType(@NotNull JetType samType) {
   FunctionDescriptor function = getAbstractMethodOfSamType(samType);
   JetType returnType = function.getReturnType();
   assert returnType != null : "function is not initialized: " + function;
   List<JetType> parameterTypes = Lists.newArrayList();
   for (ValueParameterDescriptor parameter : function.getValueParameters()) {
     parameterTypes.add(parameter.getType());
   }
   JetType functionType =
       KotlinBuiltIns.getInstance()
           .getFunctionType(
               Collections.<AnnotationDescriptor>emptyList(), null, parameterTypes, returnType);
   return TypeUtils.makeNullableAsSpecified(functionType, samType.isNullable());
 }