Search in sources :

Example 1 with IntegerValueTypeConstructor

use of org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor in project kotlin by JetBrains.

the class ArgumentTypeResolver method updateResultArgumentTypeIfNotDenotable.

@Nullable
public KotlinType updateResultArgumentTypeIfNotDenotable(@NotNull ResolutionContext context, @NotNull KtExpression expression) {
    KotlinType type = context.trace.getType(expression);
    if (type != null && !type.getConstructor().isDenotable()) {
        if (type.getConstructor() instanceof IntegerValueTypeConstructor) {
            IntegerValueTypeConstructor constructor = (IntegerValueTypeConstructor) type.getConstructor();
            KotlinType primitiveType = TypeUtils.getPrimitiveNumberType(constructor, context.expectedType);
            constantExpressionEvaluator.updateNumberType(primitiveType, expression, context.statementFilter, context.trace);
            return primitiveType;
        }
    }
    return null;
}
Also used : KotlinType(org.jetbrains.kotlin.types.KotlinType) IntegerValueTypeConstructor(org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Nullable (org.jetbrains.annotations.Nullable)1 IntegerValueTypeConstructor (org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor)1 KotlinType (org.jetbrains.kotlin.types.KotlinType)1