isNothing() made static

This commit is contained in:
Andrey Breslav
2014-12-02 15:53:39 +03:00
parent ea4f0ab214
commit 7a41e37655
20 changed files with 29 additions and 29 deletions
@@ -198,7 +198,7 @@ public class JetControlFlowProcessor {
}
JetType type = trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
if (type != null && KotlinBuiltIns.getInstance().isNothing(type)) {
if (type != null && KotlinBuiltIns.isNothing(type)) {
builder.jumpToError(expression);
}
}
@@ -115,7 +115,7 @@ public final class WhenChecker {
JetType type = trace.getBindingContext().get(
EXPRESSION_TYPE, ((JetWhenConditionWithExpression) condition).getExpression()
);
if (type != null && KotlinBuiltIns.getInstance().isNothingOrNullableNothing(type)) {
if (type != null && KotlinBuiltIns.isNothingOrNullableNothing(type)) {
return true;
}
}
@@ -486,7 +486,7 @@ public class JetControlFlowInstructionsGenerator extends JetControlFlowBuilderAd
resolvedCall,
receiverValues,
arguments,
returnType != null && KotlinBuiltIns.getInstance().isNothing(returnType) ? null : valueFactory
returnType != null && KotlinBuiltIns.isNothing(returnType) ? null : valueFactory
);
add(instruction);
return instruction;
@@ -736,12 +736,12 @@ public class DescriptorResolver {
@NotNull TypeParameterDescriptor parameter,
@NotNull JetTypeParameter typeParameter
) {
if (KotlinBuiltIns.getInstance().isNothing(parameter.getUpperBoundsAsType())) {
if (KotlinBuiltIns.isNothing(parameter.getUpperBoundsAsType())) {
trace.report(CONFLICTING_UPPER_BOUNDS.on(typeParameter, parameter));
}
JetType classObjectType = parameter.getClassObjectType();
if (classObjectType != null && KotlinBuiltIns.getInstance().isNothing(classObjectType)) {
if (classObjectType != null && KotlinBuiltIns.isNothing(classObjectType)) {
trace.report(CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS.on(typeParameter, parameter));
}
}
@@ -50,7 +50,7 @@ public class ReifiedTypeParameterSubstitutionCheck implements CallResolverExtens
Errors.TYPE_PARAMETER_AS_REIFIED.on(getCallElement(context), parameter)
);
}
else if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(argument) || TypesPackage.isDynamic(argument)) {
else if (KotlinBuiltIns.isNothingOrNullableNothing(argument) || TypesPackage.isDynamic(argument)) {
context.trace.report(Errors.REIFIED_TYPE_FORBIDDEN_SUBSTITUTION.on(getCallElement(context), argument));
}
}
@@ -43,7 +43,7 @@ public class CastDiagnosticsUtil {
@NotNull JetType rhsType,
@NotNull PlatformToKotlinClassMap platformToKotlinClassMap
) {
if (KotlinBuiltIns.getInstance().isNullableNothing(lhsType) && !TypeUtils.isNullableType(rhsType)) return false;
if (KotlinBuiltIns.isNullableNothing(lhsType) && !TypeUtils.isNullableType(rhsType)) return false;
if (isRelated(lhsType, rhsType, platformToKotlinClassMap)) return true;
// This is an oversimplification (which does not render the method incomplete):
// we consider any type parameter capable of taking any value, which may be made more precise if we considered bounds
@@ -91,7 +91,7 @@ public class SubstitutionUtils {
fullSubstitution.put(parameter.getTypeConstructor(), substitute);
}
}
if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(context)) return;
if (KotlinBuiltIns.isNothingOrNullableNothing(context)) return;
for (JetType supertype : context.getConstructor().getSupertypes()) {
fillInDeepSubstitutor(supertype, substitutor, substitution, fullSubstitution);
}
@@ -1079,7 +1079,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetType rightType = rightTypeInfo.getType();
DataFlowInfo dataFlowInfo = resolvedCall.getDataFlowInfoForArguments().getResultInfo();
if (leftType != null && rightType != null && KotlinBuiltIns.getInstance().isNothingOrNullableNothing(rightType) && !rightType.isNullable()) {
if (leftType != null && rightType != null && KotlinBuiltIns.isNothingOrNullableNothing(rightType) && !rightType.isNullable()) {
DataFlowValue value = createDataFlowValue(left, leftType, context.trace.getBindingContext());
dataFlowInfo = dataFlowInfo.disequate(value, DataFlowValue.NULL);
}
@@ -130,8 +130,8 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
DataFlowInfo thenDataFlowInfo = thenTypeInfo.getDataFlowInfo();
DataFlowInfo elseDataFlowInfo = elseTypeInfo.getDataFlowInfo();
boolean jumpInThen = thenType != null && KotlinBuiltIns.getInstance().isNothing(thenType);
boolean jumpInElse = elseType != null && KotlinBuiltIns.getInstance().isNothing(elseType);
boolean jumpInThen = thenType != null && KotlinBuiltIns.isNothing(thenType);
boolean jumpInElse = elseType != null && KotlinBuiltIns.isNothing(elseType);
DataFlowInfo resultDataFlowInfo;
if (thenType == null && elseType == null) {
@@ -167,7 +167,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
presentScope, Collections.singletonList(presentBranch), CoercionStrategy.NO_COERCION, newContext, context.trace);
JetType type = typeInfo.getType();
DataFlowInfo dataFlowInfo;
if (type != null && KotlinBuiltIns.getInstance().isNothing(type)) {
if (type != null && KotlinBuiltIns.isNothing(type)) {
dataFlowInfo = otherInfo;
} else {
dataFlowInfo = typeInfo.getDataFlowInfo().or(otherInfo);
@@ -325,7 +325,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
}
// check if the pattern is essentially a 'null' expression
if (KotlinBuiltIns.getInstance().isNullableNothing(type) && !TypeUtils.isNullableType(subjectType)) {
if (KotlinBuiltIns.isNullableNothing(type) && !TypeUtils.isNullableType(subjectType)) {
context.trace.report(SENSELESS_NULL_IN_WHEN.on(reportErrorOn));
}
}