New ieee754 arithmetic, Fix for KT-14651: Floating point comparisons shall operate according to IEEE754
This commit is contained in:
@@ -138,6 +138,10 @@ public class AsmUtil {
|
|||||||
return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE || type == Type.CHAR_TYPE;
|
return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE || type == Type.CHAR_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isNumberPrimitiveOrBoolean(Type type) {
|
||||||
|
return isNumberPrimitive(type) || type.getSort() == Type.BOOLEAN;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isNumberPrimitive(Type type) {
|
public static boolean isNumberPrimitive(Type type) {
|
||||||
return isIntPrimitive(type) || type == Type.FLOAT_TYPE || type == Type.DOUBLE_TYPE || type == Type.LONG_TYPE;
|
return isIntPrimitive(type) || type == Type.FLOAT_TYPE || type == Type.DOUBLE_TYPE || type == Type.LONG_TYPE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -424,13 +424,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Type expressionType(@Nullable KtExpression expression) {
|
public Type expressionType(@Nullable KtExpression expression) {
|
||||||
KotlinType type = expressionJetType(expression);
|
return CodegenUtilKt.asmType(expression, typeMapper, bindingContext);
|
||||||
return type == null ? Type.VOID_TYPE : asmType(type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public KotlinType expressionJetType(@Nullable KtExpression expression) {
|
private KotlinType expressionJetType(@Nullable KtExpression expression) {
|
||||||
return expression != null ? bindingContext.getType(expression) : null;
|
return CodegenUtilKt.kotlinType(expression, bindingContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -3624,7 +3623,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
return StackValue.or(gen(expression.getLeft()), gen(expression.getRight()));
|
return StackValue.or(gen(expression.getLeft()), gen(expression.getRight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private StackValue generateEquals(KtExpression left, KtExpression right, IElementType opToken) {
|
private StackValue generateEquals(@Nullable KtExpression left, @Nullable KtExpression right, @NotNull IElementType opToken) {
|
||||||
Type leftType = expressionType(left);
|
Type leftType = expressionType(left);
|
||||||
Type rightType = expressionType(right);
|
Type rightType = expressionType(right);
|
||||||
|
|
||||||
@@ -3649,16 +3648,36 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
rightType = boxType(rightType);
|
rightType = boxType(rightType);
|
||||||
}
|
}
|
||||||
|
|
||||||
StackValue leftValue = genLazy(left, leftType);
|
|
||||||
StackValue rightValue = genLazy(right, rightType);
|
|
||||||
|
|
||||||
if (opToken == KtTokens.EQEQEQ || opToken == KtTokens.EXCLEQEQEQ) {
|
if (opToken == KtTokens.EQEQEQ || opToken == KtTokens.EXCLEQEQEQ) {
|
||||||
// TODO: always casting to the type of the left operand in case of primitives looks wrong
|
// TODO: always casting to the type of the left operand in case of primitives looks wrong
|
||||||
Type operandType = isPrimitive(leftType) ? leftType : OBJECT_TYPE;
|
Type operandType = isPrimitive(leftType) ? leftType : OBJECT_TYPE;
|
||||||
return StackValue.cmp(opToken, operandType, leftValue, rightValue);
|
return StackValue.cmp(opToken, operandType, genLazy(left, leftType), genLazy(right, rightType));
|
||||||
}
|
}
|
||||||
|
|
||||||
return genEqualsForExpressionsOnStack(opToken, leftValue, rightValue);
|
return genEqualsForExpressionsPreferIEEE754Arithmetic(left, right, opToken, leftType, rightType, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*tries to use IEEE 754 arithmetic*/
|
||||||
|
private StackValue genEqualsForExpressionsPreferIEEE754Arithmetic(
|
||||||
|
@Nullable KtExpression left,
|
||||||
|
@Nullable KtExpression right,
|
||||||
|
@NotNull IElementType opToken,
|
||||||
|
@NotNull Type leftType,
|
||||||
|
@NotNull Type rightType,
|
||||||
|
@Nullable StackValue pregeneratedLeft
|
||||||
|
) {
|
||||||
|
Type left754Type = calcTypeForIEEE754ArithmeticIfNeeded(left);
|
||||||
|
Type right754Type = calcTypeForIEEE754ArithmeticIfNeeded(right);
|
||||||
|
if (left754Type != null && right754Type != null && left754Type.equals(right754Type)) {
|
||||||
|
leftType = left754Type;
|
||||||
|
rightType = right754Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
return genEqualsForExpressionsOnStack(
|
||||||
|
opToken,
|
||||||
|
pregeneratedLeft != null ? StackValue.coercion(pregeneratedLeft, leftType) : genLazy(left, leftType),
|
||||||
|
genLazy(right, rightType)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isIntZero(KtExpression expr, Type exprType) {
|
private boolean isIntZero(KtExpression expr, Type exprType) {
|
||||||
@@ -3722,9 +3741,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
StackValue rightValue;
|
StackValue rightValue;
|
||||||
Type leftType = expressionType(left);
|
Type leftType = expressionType(left);
|
||||||
Type rightType = expressionType(right);
|
Type rightType = expressionType(right);
|
||||||
|
Type left754Type = calcTypeForIEEE754ArithmeticIfNeeded(left);
|
||||||
|
Type right754Type = calcTypeForIEEE754ArithmeticIfNeeded(right);
|
||||||
Callable callable = resolveToCallable((FunctionDescriptor) resolvedCall.getResultingDescriptor(), false, resolvedCall);
|
Callable callable = resolveToCallable((FunctionDescriptor) resolvedCall.getResultingDescriptor(), false, resolvedCall);
|
||||||
if (isPrimitive(leftType) && isPrimitive(rightType) && callable instanceof IntrinsicCallable) {
|
boolean is754Arithmetic = left754Type != null && right754Type != null && left754Type.equals(right754Type);
|
||||||
type = comparisonOperandType(leftType, rightType);
|
if (callable instanceof IntrinsicCallable && ((isPrimitive(leftType) && isPrimitive(rightType)) || is754Arithmetic)) {
|
||||||
|
type = is754Arithmetic ? left754Type : comparisonOperandType(leftType, rightType);
|
||||||
leftValue = gen(left);
|
leftValue = gen(left);
|
||||||
rightValue = gen(right);
|
rightValue = gen(right);
|
||||||
}
|
}
|
||||||
@@ -3736,6 +3758,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
return StackValue.cmp(expression.getOperationToken(), type, leftValue, rightValue);
|
return StackValue.cmp(expression.getOperationToken(), type, leftValue, rightValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Type calcTypeForIEEE754ArithmeticIfNeeded(@Nullable KtExpression expression) {
|
||||||
|
return CodegenUtilKt.calcTypeForIEEE754ArithmeticIfNeeded(expression, bindingContext, context.getFunctionDescriptor());
|
||||||
|
}
|
||||||
|
|
||||||
private StackValue generateAssignmentExpression(final KtBinaryExpression expression) {
|
private StackValue generateAssignmentExpression(final KtBinaryExpression expression) {
|
||||||
return StackValue.operation(Type.VOID_TYPE, new Function1<InstructionAdapter, Unit>() {
|
return StackValue.operation(Type.VOID_TYPE, new Function1<InstructionAdapter, Unit>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -4491,24 +4517,24 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
return generateIsCheck(match, expression.getTypeReference(), expression.isNegated());
|
return generateIsCheck(match, expression.getTypeReference(), expression.isNegated());
|
||||||
}
|
}
|
||||||
|
|
||||||
private StackValue generateExpressionMatch(StackValue expressionToMatch, KtExpression patternExpression) {
|
private StackValue generateExpressionMatch(StackValue expressionToMatch, KtExpression subjectExpression, KtExpression patternExpression) {
|
||||||
if (expressionToMatch != null) {
|
if (expressionToMatch != null) {
|
||||||
Type subjectType = expressionToMatch.type;
|
Type subjectType = expressionToMatch.type;
|
||||||
markStartLineNumber(patternExpression);
|
markStartLineNumber(patternExpression);
|
||||||
KotlinType condJetType = bindingContext.getType(patternExpression);
|
KotlinType condJetType = bindingContext.getType(patternExpression);
|
||||||
Type condType;
|
Type condType;
|
||||||
if (isNumberPrimitive(subjectType) || subjectType.getSort() == Type.BOOLEAN) {
|
if (isNumberPrimitiveOrBoolean(subjectType)) {
|
||||||
assert condJetType != null;
|
assert condJetType != null;
|
||||||
condType = asmType(condJetType);
|
condType = asmType(condJetType);
|
||||||
if (!(isNumberPrimitive(condType) || condType.getSort() == Type.BOOLEAN)) {
|
if (!isNumberPrimitiveOrBoolean(condType)) {
|
||||||
subjectType = boxType(subjectType);
|
subjectType = boxType(subjectType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
condType = OBJECT_TYPE;
|
condType = OBJECT_TYPE;
|
||||||
}
|
}
|
||||||
StackValue condition = genLazy(patternExpression, condType);
|
|
||||||
return genEqualsForExpressionsOnStack(KtTokens.EQEQ, StackValue.coercion(expressionToMatch, subjectType), condition);
|
return genEqualsForExpressionsPreferIEEE754Arithmetic(subjectExpression, patternExpression, KtTokens.EQEQ, subjectType, condType, expressionToMatch);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return gen(patternExpression);
|
return gen(patternExpression);
|
||||||
@@ -4616,7 +4642,7 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
if (!whenEntry.isElse()) {
|
if (!whenEntry.isElse()) {
|
||||||
KtWhenCondition[] conditions = whenEntry.getConditions();
|
KtWhenCondition[] conditions = whenEntry.getConditions();
|
||||||
for (int i = 0; i < conditions.length; i++) {
|
for (int i = 0; i < conditions.length; i++) {
|
||||||
StackValue conditionValue = generateWhenCondition(subjectType, subjectLocal, conditions[i]);
|
StackValue conditionValue = generateWhenCondition(expr, subjectType, subjectLocal, conditions[i]);
|
||||||
BranchedValue.Companion.condJump(conditionValue, nextCondition, true, v);
|
BranchedValue.Companion.condJump(conditionValue, nextCondition, true, v);
|
||||||
if (i < conditions.length - 1) {
|
if (i < conditions.length - 1) {
|
||||||
v.goTo(thisEntry);
|
v.goTo(thisEntry);
|
||||||
@@ -4671,7 +4697,7 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StackValue generateWhenCondition(Type subjectType, int subjectLocal, KtWhenCondition condition) {
|
private StackValue generateWhenCondition(KtExpression subjectExpression, Type subjectType, int subjectLocal, KtWhenCondition condition) {
|
||||||
if (condition instanceof KtWhenConditionInRange) {
|
if (condition instanceof KtWhenConditionInRange) {
|
||||||
KtWhenConditionInRange conditionInRange = (KtWhenConditionInRange) condition;
|
KtWhenConditionInRange conditionInRange = (KtWhenConditionInRange) condition;
|
||||||
return generateIn(StackValue.local(subjectLocal, subjectType),
|
return generateIn(StackValue.local(subjectLocal, subjectType),
|
||||||
@@ -4685,7 +4711,7 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
}
|
}
|
||||||
else if (condition instanceof KtWhenConditionWithExpression) {
|
else if (condition instanceof KtWhenConditionWithExpression) {
|
||||||
KtExpression patternExpression = ((KtWhenConditionWithExpression) condition).getExpression();
|
KtExpression patternExpression = ((KtWhenConditionWithExpression) condition).getExpression();
|
||||||
return generateExpressionMatch(match, patternExpression);
|
return generateExpressionMatch(match, subjectExpression, patternExpression);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new UnsupportedOperationException("unsupported kind of when condition");
|
throw new UnsupportedOperationException("unsupported kind of when condition");
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package org.jetbrains.kotlin.codegen
|
package org.jetbrains.kotlin.codegen
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext
|
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext
|
||||||
import org.jetbrains.kotlin.codegen.context.PackageContext
|
import org.jetbrains.kotlin.codegen.context.PackageContext
|
||||||
import org.jetbrains.kotlin.codegen.intrinsics.TypeIntrinsics
|
import org.jetbrains.kotlin.codegen.intrinsics.TypeIntrinsics
|
||||||
@@ -31,12 +32,15 @@ import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.
|
|||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
||||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||||
|
import org.jetbrains.kotlin.psi.KtExpression
|
||||||
import org.jetbrains.kotlin.psi.KtObjectDeclaration
|
import org.jetbrains.kotlin.psi.KtObjectDeclaration
|
||||||
import org.jetbrains.kotlin.psi.KtProperty
|
import org.jetbrains.kotlin.psi.KtProperty
|
||||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.annotations.hasJvmStaticAnnotation
|
import org.jetbrains.kotlin.resolve.annotations.hasJvmStaticAnnotation
|
||||||
|
import org.jetbrains.kotlin.resolve.bindingContextUtil.getDataFlowInfoBefore
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME
|
import org.jetbrains.kotlin.serialization.deserialization.PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME
|
||||||
@@ -44,6 +48,7 @@ import org.jetbrains.kotlin.types.ErrorUtils
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import org.jetbrains.kotlin.utils.DFS
|
import org.jetbrains.kotlin.utils.DFS
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||||
import org.jetbrains.org.objectweb.asm.Label
|
import org.jetbrains.org.objectweb.asm.Label
|
||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||||
@@ -257,3 +262,38 @@ private fun CallableDescriptor.isJvmStaticIn(predicate: (DeclarationDescriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Collection<VariableDescriptor>.filterOutDescriptorsWithSpecialNames() = filterNot { it.name.isSpecial }
|
fun Collection<VariableDescriptor>.filterOutDescriptorsWithSpecialNames() = filterNot { it.name.isSpecial }
|
||||||
|
|
||||||
|
|
||||||
|
fun calcTypeForIEEE754ArithmeticIfNeeded(expression: KtExpression?, bindingContext: BindingContext, descriptor: DeclarationDescriptor): Type? {
|
||||||
|
val ktType = expression.kotlinType(bindingContext) ?: return null
|
||||||
|
|
||||||
|
if (KotlinBuiltIns.isDoubleOrNullableDouble(ktType)) {
|
||||||
|
return Type.DOUBLE_TYPE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KotlinBuiltIns.isFloatOrNullableFloat(ktType)) {
|
||||||
|
return Type.FLOAT_TYPE
|
||||||
|
}
|
||||||
|
|
||||||
|
val dataFlow = DataFlowValueFactory.createDataFlowValue(expression!!, ktType, bindingContext, descriptor)
|
||||||
|
val stableTypes = bindingContext.getDataFlowInfoBefore(expression).getStableTypes(dataFlow)
|
||||||
|
return stableTypes.firstNotNullResult {
|
||||||
|
if (KotlinBuiltIns.isDoubleOrNullableDouble(it)) {
|
||||||
|
Type.DOUBLE_TYPE
|
||||||
|
}
|
||||||
|
else if (KotlinBuiltIns.isFloatOrNullableFloat(it)) {
|
||||||
|
Type.FLOAT_TYPE
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun KotlinType.asmType(typeMapper: KotlinTypeMapper) = typeMapper.mapType(this)
|
||||||
|
|
||||||
|
fun KtExpression?.asmType(typeMapper: KotlinTypeMapper, bindingContext: BindingContext): Type =
|
||||||
|
this.kotlinType(bindingContext)?.asmType(typeMapper) ?: Type.VOID_TYPE
|
||||||
|
|
||||||
|
fun KtExpression?.kotlinType(bindingContext: BindingContext) = this?.let(bindingContext::getType)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
fun box(): String {
|
||||||
|
val plusZero: Any = 0.0
|
||||||
|
val minusZero: Any = -0.0
|
||||||
|
if ((minusZero as Double) < (plusZero as Double)) return "fail 0"
|
||||||
|
|
||||||
|
val plusZeroF: Any = 0.0F
|
||||||
|
val minusZeroF: Any = -0.0F
|
||||||
|
if ((minusZeroF as Float) < (plusZeroF as Float)) return "fail 1"
|
||||||
|
|
||||||
|
if ((minusZero as Double) != (plusZero as Double)) return "fail 3"
|
||||||
|
|
||||||
|
if ((minusZeroF as Float) != (plusZeroF as Float)) return "fail 4"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
fun box(): String {
|
||||||
|
if ((-0.0 as Comparable<Double>) >= 0.0) return "fail 0"
|
||||||
|
if ((-0.0F as Comparable<Float>) >= 0.0F) return "fail 1"
|
||||||
|
|
||||||
|
|
||||||
|
if ((-0.0 as Comparable<Double>) == 0.0) return "fail 3"
|
||||||
|
if (-0.0 == (0.0 as Comparable<Double>)) return "fail 4"
|
||||||
|
|
||||||
|
if ((-0.0F as Comparable<Float>) == 0.0F) return "fail 5"
|
||||||
|
if (-0.0F == (0.0F as Comparable<Float>)) return "fail 6"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
data class Test(val z1: Double, val z2: Double?)
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val x = Test(Double.NaN, Double.NaN)
|
||||||
|
val y = Test(Double.NaN, Double.NaN)
|
||||||
|
|
||||||
|
return if (x == y) "OK" else "fail"
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
fun equals1(a: Double, b: Double) = a == b
|
||||||
|
|
||||||
|
fun equals2(a: Double?, b: Double?) = a!! == b!!
|
||||||
|
|
||||||
|
fun equals3(a: Double?, b: Double?) = a != null && b != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Double?, b: Double?) = if (a is Double && b is Double) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Double && b is Double) a == b else null!!
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (-0.0 != 0.0) return "fail 0"
|
||||||
|
if (!equals1(-0.0, 0.0)) return "fail 1"
|
||||||
|
if (!equals2(-0.0, 0.0)) return "fail 2"
|
||||||
|
if (!equals3(-0.0, 0.0)) return "fail 3"
|
||||||
|
if (!equals4(-0.0, 0.0)) return "fail 4"
|
||||||
|
if (!equals5(-0.0, 0.0)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
fun equals1(a: Float, b: Float) = a == b
|
||||||
|
|
||||||
|
fun equals2(a: Float?, b: Float?) = a!! == b!!
|
||||||
|
|
||||||
|
fun equals3(a: Float?, b: Float?) = a != null && b != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Float?, b: Float?) = if (a is Float && b is Float) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Float && b is Float) a == b else null!!
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (-0.0F != 0.0F) return "fail 0"
|
||||||
|
if (!equals1(-0.0F, 0.0F)) return "fail 1"
|
||||||
|
if (!equals2(-0.0F, 0.0F)) return "fail 2"
|
||||||
|
if (!equals3(-0.0F, 0.0F)) return "fail 3"
|
||||||
|
if (!equals4(-0.0F, 0.0F)) return "fail 4"
|
||||||
|
if (!equals5(-0.0F, 0.0F)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
fun equals1(a: Double, b: Double?) = a == b
|
||||||
|
|
||||||
|
fun equals2(a: Double?, b: Double?) = a!! == b!!
|
||||||
|
|
||||||
|
fun equals3(a: Double?, b: Double?) = a != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Double?, b: Double?) = if (a is Double) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Double && b is Double?) a == b else null!!
|
||||||
|
|
||||||
|
fun equals6(a: Any?, b: Any?) = if (a is Double? && b is Double) a == b else null!!
|
||||||
|
|
||||||
|
fun equals7(a: Double?, b: Double?) = a == b
|
||||||
|
|
||||||
|
fun equals8(a: Any?, b: Any?) = if (a is Double? && b is Double?) a == b else null!!
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (!equals1(-0.0, 0.0)) return "fail 1"
|
||||||
|
if (!equals2(-0.0, 0.0)) return "fail 2"
|
||||||
|
if (!equals3(-0.0, 0.0)) return "fail 3"
|
||||||
|
if (!equals4(-0.0, 0.0)) return "fail 4"
|
||||||
|
if (!equals5(-0.0, 0.0)) return "fail 5"
|
||||||
|
if (!equals6(-0.0, 0.0)) return "fail 6"
|
||||||
|
if (!equals7(-0.0, 0.0)) return "fail 7"
|
||||||
|
if (!equals8(-0.0, 0.0)) return "fail 8"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
fun less1(a: Double, b: Double) = a.compareTo(b) == -1
|
||||||
|
|
||||||
|
fun less2(a: Double?, b: Double?) = a!!.compareTo(b!!) == -1
|
||||||
|
|
||||||
|
fun less3(a: Double?, b: Double?) = a != null && b != null && a.compareTo(b) == -1
|
||||||
|
|
||||||
|
fun less4(a: Double?, b: Double?) = if (a is Double && b is Double) a.compareTo(b) == -1 else null!!
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Double && b is Double) a.compareTo(b) == -1 else null!!
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (!less1(-0.0, 0.0)) return "fail 1"
|
||||||
|
if (!less2(-0.0, 0.0)) return "fail 2"
|
||||||
|
if (!less3(-0.0, 0.0)) return "fail 3"
|
||||||
|
if (!less4(-0.0, 0.0)) return "fail 4"
|
||||||
|
if (!less5(-0.0, 0.0)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
|
||||||
|
fun equals1(a: Double, b: Double) = a.equals(b)
|
||||||
|
|
||||||
|
fun equals2(a: Double?, b: Double?) = a!!.equals(b!!)
|
||||||
|
|
||||||
|
fun equals3(a: Double?, b: Double?) = a != null && b != null && a.equals(b)
|
||||||
|
|
||||||
|
fun equals4(a: Double?, b: Double?) = if (a is Double && b is Double) a.equals(b) else null!!
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if ((-0.0).equals(0.0)) return "fail 0"
|
||||||
|
if (equals1(-0.0, 0.0)) return "fail 1"
|
||||||
|
if (equals2(-0.0, 0.0)) return "fail 2"
|
||||||
|
if (equals3(-0.0, 0.0)) return "fail 3"
|
||||||
|
if (equals4(-0.0, 0.0)) return "fail 4"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
class Foo<T>(val minus0: T, val plus0: T) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val foo = Foo<Double>(-0.0, 0.0)
|
||||||
|
val fooF = Foo<Float>(-0.0F, 0.0F)
|
||||||
|
|
||||||
|
if (foo.minus0 < foo.plus0) return "fail 0"
|
||||||
|
if (fooF.minus0 < fooF.plus0) return "fail 1"
|
||||||
|
|
||||||
|
if (foo.minus0 != foo.plus0) return "fail 3"
|
||||||
|
if (fooF.minus0 != fooF.plus0) return "fail 4"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
fun greater1(a: Double, b: Double) = a > b
|
||||||
|
|
||||||
|
fun greater2(a: Double?, b: Double?) = a!! > b!!
|
||||||
|
|
||||||
|
fun greater3(a: Double?, b: Double?) = a != null && b != null && a > b
|
||||||
|
|
||||||
|
fun greater4(a: Double?, b: Double?) = if (a is Double && b is Double) a > b else null!!
|
||||||
|
|
||||||
|
fun greater5(a: Any?, b: Any?) = if (a is Double && b is Double) a > b else null!!
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (0.0 > -0.0) return "fail 0"
|
||||||
|
if (greater1(0.0, -0.0)) return "fail 1"
|
||||||
|
if (greater2(0.0, -0.0)) return "fail 2"
|
||||||
|
if (greater3(0.0, -0.0)) return "fail 3"
|
||||||
|
if (greater4(0.0, -0.0)) return "fail 4"
|
||||||
|
if (greater5(0.0, -0.0)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
fun greater1(a: Float, b: Float) = a > b
|
||||||
|
|
||||||
|
fun greater2(a: Float?, b: Float?) = a!! > b!!
|
||||||
|
|
||||||
|
fun greater3(a: Float?, b: Float?) = a != null && b != null && a > b
|
||||||
|
|
||||||
|
fun greater4(a: Float?, b: Float?) = if (a is Float && b is Float) a > b else null!!
|
||||||
|
|
||||||
|
fun greater5(a: Any?, b: Any?) = if (a is Float && b is Float) a > b else null!!
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (0.0F > -0.0F) return "fail 0"
|
||||||
|
if (greater1(0.0F, -0.0F)) return "fail 1"
|
||||||
|
if (greater2(0.0F, -0.0F)) return "fail 2"
|
||||||
|
if (greater3(0.0F, -0.0F)) return "fail 3"
|
||||||
|
if (greater4(0.0F, -0.0F)) return "fail 4"
|
||||||
|
if (greater5(0.0F, -0.0F)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
|
||||||
|
inline fun less(a: Comparable<Double>, b: Double): Boolean {
|
||||||
|
return a < b
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun equals(a: Comparable<Double>, b: Comparable<Double>): Boolean {
|
||||||
|
return a == b
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <T: Comparable<Double>> lessGeneric(a: T, b: Double): Boolean {
|
||||||
|
return a < b
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <T: Comparable<Double>> equalsGeneric(a: T, b: Double): Boolean {
|
||||||
|
return a == b
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T: Comparable<Double>> lessReified(a: T, b: Double): Boolean {
|
||||||
|
return a < b
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T: Comparable<Double>> equalsReified(a: T, b: T): Boolean {
|
||||||
|
return a == b
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun less754(a: Double, b: Double): Boolean {
|
||||||
|
return a < b
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun equals754(a: Double, b: Double): Boolean {
|
||||||
|
return a == b
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (!less(-0.0, 0.0)) return "fail 1"
|
||||||
|
if (equals(-0.0, 0.0)) return "fail 2"
|
||||||
|
|
||||||
|
if (!lessGeneric(-0.0, 0.0)) return "fail 3"
|
||||||
|
if (equalsGeneric(-0.0, 0.0)) return "fail 4"
|
||||||
|
|
||||||
|
if (!lessReified(-0.0, 0.0)) return "fail 5"
|
||||||
|
if (equalsReified(-0.0, 0.0)) return "fail 6"
|
||||||
|
|
||||||
|
if (less754(-0.0, 0.0)) return "fail 7"
|
||||||
|
if (!equals754(-0.0, 0.0)) return "fail 8"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
fun less1(a: Double, b: Double) = a < b
|
||||||
|
|
||||||
|
fun less2(a: Double?, b: Double?) = a!! < b!!
|
||||||
|
|
||||||
|
fun less3(a: Double?, b: Double?) = a != null && b != null && a < b
|
||||||
|
|
||||||
|
fun less4(a: Double?, b: Double?) = if (a is Double && b is Double) a < b else null!!
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Double && b is Double) a < b else null!!
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (-0.0 < 0.0) return "fail 0"
|
||||||
|
if (less1(-0.0, 0.0)) return "fail 1"
|
||||||
|
if (less2(-0.0, 0.0)) return "fail 2"
|
||||||
|
if (less3(-0.0, 0.0)) return "fail 3"
|
||||||
|
if (less4(-0.0, 0.0)) return "fail 4"
|
||||||
|
if (less5(-0.0, 0.0)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
fun less1(a: Float, b: Float) = a < b
|
||||||
|
|
||||||
|
fun less2(a: Float?, b: Float?) = a!! < b!!
|
||||||
|
|
||||||
|
fun less3(a: Float?, b: Float?) = a != null && b != null && a < b
|
||||||
|
|
||||||
|
fun less4(a: Float?, b: Float?) = if (a is Float && b is Float) a < b else true
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Float && b is Float) a < b else true
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (-0.0F < 0.0F) return "fail 0"
|
||||||
|
if (less1(-0.0F, 0.0F)) return "fail 1"
|
||||||
|
if (less2(-0.0F, 0.0F)) return "fail 2"
|
||||||
|
if (less3(-0.0F, 0.0F)) return "fail 3"
|
||||||
|
if (less4(-0.0F, 0.0F)) return "fail 4"
|
||||||
|
if (less5(-0.0F, 0.0F)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
fun box(): String {
|
||||||
|
val plusZero: Any? = 0.0
|
||||||
|
val minusZero: Any? = -0.0
|
||||||
|
if ((minusZero as Double) < (plusZero as Double)) return "fail 0"
|
||||||
|
|
||||||
|
val plusZeroF: Any? = 0.0F
|
||||||
|
val minusZeroF: Any? = -0.0F
|
||||||
|
if ((minusZeroF as Float) < (plusZeroF as Float)) return "fail 1"
|
||||||
|
|
||||||
|
if ((minusZero as Double) != (plusZero as Double)) return "fail 3"
|
||||||
|
|
||||||
|
if ((minusZeroF as Float) != (plusZeroF as Float)) return "fail 4"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
fun box(): String {
|
||||||
|
val plusZero: Double? = 0.0
|
||||||
|
val minusZero: Double = -0.0
|
||||||
|
if (plusZero?.equals(minusZero) ?: null!!) {
|
||||||
|
return "fail 1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plusZero?.compareTo(minusZero) ?: null!! != 1) {
|
||||||
|
return "fail 2"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
fun box(): String {
|
||||||
|
val zero: Any = 0.0
|
||||||
|
val floatZero: Any = -0.0F
|
||||||
|
if (zero is Double && floatZero is Float) {
|
||||||
|
if (zero == floatZero) return "fail 1"
|
||||||
|
|
||||||
|
if (zero <= floatZero) return "fail 2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
fun box(): String {
|
||||||
|
val plusZero: Any = 0.0
|
||||||
|
val minusZero: Any = -0.0
|
||||||
|
if (plusZero is Double) {
|
||||||
|
when (plusZero) {
|
||||||
|
-0.0 -> {
|
||||||
|
}
|
||||||
|
else -> return "fail 1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minusZero is Double) {
|
||||||
|
when (plusZero) {
|
||||||
|
minusZero -> {
|
||||||
|
}
|
||||||
|
else -> return "fail 2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
fun box(): String {
|
||||||
|
val plusZero: Any = 0.0
|
||||||
|
val minusZero: Any = -0.0
|
||||||
|
if (plusZero is Double && minusZero is Double) {
|
||||||
|
when {
|
||||||
|
plusZero < minusZero -> {
|
||||||
|
return "fail 1"
|
||||||
|
}
|
||||||
|
|
||||||
|
plusZero > minusZero -> {
|
||||||
|
return "fail 2"
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
when {
|
||||||
|
plusZero == minusZero -> {
|
||||||
|
}
|
||||||
|
else -> return "fail 3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
|
||||||
|
public Object minus0()
|
||||||
|
{
|
||||||
|
return -0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object plus0()
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val jClass = JavaClass()
|
||||||
|
|
||||||
|
if ((jClass.minus0() as Double) < (jClass.plus0() as Double)) return "fail 1"
|
||||||
|
|
||||||
|
if ((jClass.minus0() as Double) != (jClass.plus0() as Double)) return "fail 2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
|
||||||
|
public Double minus0()
|
||||||
|
{
|
||||||
|
return -0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double plus0()
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val jClass = JavaClass()
|
||||||
|
|
||||||
|
if ((jClass.minus0() as Comparable<Double>) >= jClass.plus0()) return "fail 1"
|
||||||
|
if ((jClass.minus0() as Comparable<Double>) == jClass.plus0()) return "fail 2"
|
||||||
|
if (jClass.minus0() == (jClass.plus0() as Comparable<Double>)) return "fail 3"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
|
||||||
|
public Double minus0(){
|
||||||
|
return -0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double plus0(){
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double null0(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val jClass = JavaClass()
|
||||||
|
|
||||||
|
if (jClass.minus0() < jClass.plus0()) return "fail 1"
|
||||||
|
|
||||||
|
//TODO: KT-14989
|
||||||
|
//if (jClass.null0() < jClass.plus0()) return "fail 2"
|
||||||
|
|
||||||
|
|
||||||
|
if (jClass.plus0() > jClass.minus0()) return "fail 3"
|
||||||
|
|
||||||
|
//TODO: KT-14989
|
||||||
|
//if (jClass.null0() < jClass.plus0()) return "fail 4"
|
||||||
|
|
||||||
|
if (jClass.minus0() != jClass.plus0()) return "fail 5"
|
||||||
|
|
||||||
|
//TODO: KT-14989
|
||||||
|
//if (jClass.null0() != jClass.plus0()) return "fail 6"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
|
||||||
|
public Double minus0(){
|
||||||
|
return -0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double plus0(){
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double null0(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
|
||||||
|
val jClass = JavaClass()
|
||||||
|
|
||||||
|
if (jClass.minus0().compareTo(jClass.plus0()) != -1) return "fail 1"
|
||||||
|
|
||||||
|
//TODO: KT-14989
|
||||||
|
//if (jClass.null0().compareTo(jClass.plus0())) return "fail 2"
|
||||||
|
try {
|
||||||
|
if (jClass.minus0().compareTo(jClass.null0()) != -2) return "fail 3"
|
||||||
|
return "fail: exception expected";
|
||||||
|
} catch (e: IllegalStateException) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
|
||||||
|
public Double minus0(){
|
||||||
|
return -0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double plus0(){
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double null0(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val jClass = JavaClass()
|
||||||
|
|
||||||
|
if (jClass.minus0().equals(jClass.plus0())) return "fail 5"
|
||||||
|
|
||||||
|
if (jClass.null0().equals(jClass.plus0())) return "fail 6"
|
||||||
|
if (jClass.minus0().equals(jClass.null0())) return "fail 7"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
|
||||||
|
public Float minus0()
|
||||||
|
{
|
||||||
|
return -0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float plus0()
|
||||||
|
{
|
||||||
|
return 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float null0()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val jClass = JavaClass()
|
||||||
|
|
||||||
|
if (jClass.minus0() < jClass.plus0()) return "fail 1"
|
||||||
|
|
||||||
|
//TODO: KT-14989
|
||||||
|
//if (jClass.null0() < jClass.plus0()) return "fail 2"
|
||||||
|
|
||||||
|
if (jClass.plus0() > jClass.minus0()) return "fail 3"
|
||||||
|
|
||||||
|
//TODO: KT-14989
|
||||||
|
//if (jClass.null0() < jClass.plus0()) return "fail 4"
|
||||||
|
|
||||||
|
|
||||||
|
if (jClass.minus0() != jClass.plus0()) return "fail 5"
|
||||||
|
|
||||||
|
//TODO: KT-14989
|
||||||
|
//if (jClass.null0() != jClass.plus0()) return "fail 6"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass<T> {
|
||||||
|
|
||||||
|
private T minus0;
|
||||||
|
|
||||||
|
private T plus0;
|
||||||
|
|
||||||
|
JavaClass(T minus0, T plus0)
|
||||||
|
{
|
||||||
|
this.minus0 = minus0;
|
||||||
|
this.plus0 = plus0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T minus0()
|
||||||
|
{
|
||||||
|
return minus0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T plus0()
|
||||||
|
{
|
||||||
|
return plus0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val jClass = JavaClass<Double>(-0.0, 0.0)
|
||||||
|
|
||||||
|
if (jClass.minus0() < jClass.plus0()) return "fail 2"
|
||||||
|
if (jClass.minus0() != jClass.plus0()) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
|
||||||
|
public Object minus0()
|
||||||
|
{
|
||||||
|
return -0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object plus0()
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
|
||||||
|
val jClass = JavaClass()
|
||||||
|
|
||||||
|
if ((jClass.minus0() as Double) < (jClass.plus0() as Double)) return "fail 2"
|
||||||
|
if ((jClass.minus0() as Double) != (jClass.plus0() as Double)) return "fail 5"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Byte && b is Byte) a == b else null!!
|
||||||
|
|
||||||
|
fun less3(a: Byte?, b: Byte?) = a != null && b != null && a < b
|
||||||
|
|
||||||
|
fun less4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a < b else true
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Byte && b is Byte) a < b else true
|
||||||
|
|
||||||
|
// 3 Intrinsics\.areEqual
|
||||||
|
// 3 Intrinsics\.compare
|
||||||
|
// for compare:
|
||||||
|
// 3 IF_ICMPGE
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun equals3(a: Char?, b: Char?) = a != null && b != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Char?, b: Char?) = if (a is Char && b is Char) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Char && b is Char) a == b else null!!
|
||||||
|
|
||||||
|
fun less3(a: Char?, b: Char?) = a != null && b != null && a < b
|
||||||
|
|
||||||
|
fun less4(a: Char?, b: Char?) = if (a is Char && b is Char) a < b else true
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Char && b is Char) a < b else true
|
||||||
|
|
||||||
|
// 3 Intrinsics\.areEqual
|
||||||
|
// 3 Intrinsics\.compare
|
||||||
|
// for compare:
|
||||||
|
// 3 IF_ICMPGE
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun box(): String {
|
||||||
|
val zero: Any = 0.0
|
||||||
|
val floatZero: Any = -0.0F
|
||||||
|
if (zero is Double && floatZero is Float) {
|
||||||
|
if (zero == floatZero) return "fail 1"
|
||||||
|
|
||||||
|
if (zero <= floatZero) return "fail 2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 Intrinsics\.areEqual
|
||||||
|
// 1 Double\.compare
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun equals3(a: Int?, b: Int?) = a != null && b != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Int?, b: Int?) = if (a is Int && b is Int) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Int && b is Int) a == b else null!!
|
||||||
|
|
||||||
|
fun less3(a: Int?, b: Int?) = a != null && b != null && a < b
|
||||||
|
|
||||||
|
fun less4(a: Int?, b: Int?) = if (a is Int && b is Int) a < b else true
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Int && b is Int) a < b else true
|
||||||
|
|
||||||
|
// 3 Intrinsics\.areEqual
|
||||||
|
// 3 Intrinsics\.compare
|
||||||
|
// for compare:
|
||||||
|
// 3 IF_ICMPGE
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun equals3(a: Long?, b: Long?) = a != null && b != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Long?, b: Long?) = if (a is Long && b is Long) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Long && b is Long) a == b else null!!
|
||||||
|
|
||||||
|
fun less3(a: Long?, b: Long?) = a != null && b != null && a < b
|
||||||
|
|
||||||
|
fun less4(a: Long?, b: Long?) = if (a is Long && b is Long) a < b else true
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Long && b is Long) a < b else true
|
||||||
|
|
||||||
|
// 3 Intrinsics\.areEqual
|
||||||
|
// 3 Intrinsics\.compare
|
||||||
|
// for compare:
|
||||||
|
// 3 IF_ICMPGE
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun equals3(a: Short?, b: Short?) = a != null && b != null && a == b
|
||||||
|
|
||||||
|
fun equals4(a: Short?, b: Short?) = if (a is Short && b is Short) a == b else null!!
|
||||||
|
|
||||||
|
fun equals5(a: Any?, b: Any?) = if (a is Short && b is Short) a == b else null!!
|
||||||
|
|
||||||
|
fun less3(a: Short?, b: Short?) = a != null && b != null && a < b
|
||||||
|
|
||||||
|
fun less4(a: Short?, b: Short?) = if (a is Short && b is Short) a < b else true
|
||||||
|
|
||||||
|
fun less5(a: Any?, b: Any?) = if (a is Short && b is Short) a < b else true
|
||||||
|
|
||||||
|
// 3 Intrinsics\.areEqual
|
||||||
|
// 3 Intrinsics\.compare
|
||||||
|
// for compare:
|
||||||
|
// 3 IF_ICMPGE
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
public final class AnyToRealKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
public final class ComparableTypeCastKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
public final class DataClassKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final class Test {
|
||||||
|
private final field z1: double
|
||||||
|
private final @org.jetbrains.annotations.Nullable field z2: java.lang.Double
|
||||||
|
public method <init>(p0: double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): void
|
||||||
|
public final method component1(): double
|
||||||
|
public final @org.jetbrains.annotations.Nullable method component2(): java.lang.Double
|
||||||
|
public synthetic static method copy$default(p0: Test, p1: double, p2: java.lang.Double, p3: int, p4: java.lang.Object): Test
|
||||||
|
public final @org.jetbrains.annotations.NotNull method copy(p0: double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): Test
|
||||||
|
public method equals(p0: java.lang.Object): boolean
|
||||||
|
public final method getZ1(): double
|
||||||
|
public final @org.jetbrains.annotations.Nullable method getZ2(): java.lang.Double
|
||||||
|
public method hashCode(): int
|
||||||
|
public method toString(): java.lang.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
public final class EqualsDoubleKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method equals1(p0: double, p1: double): boolean
|
||||||
|
public final static method equals2(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals3(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals4(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
public final class EqualsFloatKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method equals1(p0: float, p1: float): boolean
|
||||||
|
public final static method equals2(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method equals3(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method equals4(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method equals5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
public final class EqualsNullableDoubleKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method equals1(p0: double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals2(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals3(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals4(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
public final static method equals6(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
public final static method equals7(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals8(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
public final class ExplicitCompareCallKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method less1(p0: double, p1: double): boolean
|
||||||
|
public final static method less2(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method less3(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method less4(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method less5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
public final class ExplicitEqualsCallKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method equals1(p0: double, p1: double): boolean
|
||||||
|
public final static method equals2(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals3(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method equals4(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
public final class BKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final class Foo {
|
||||||
|
private final field minus0: java.lang.Object
|
||||||
|
private final field plus0: java.lang.Object
|
||||||
|
public method <init>(p0: java.lang.Object, p1: java.lang.Object): void
|
||||||
|
public final method getMinus0(): java.lang.Object
|
||||||
|
public final method getPlus0(): java.lang.Object
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
public final class GreaterDoubleKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method greater1(p0: double, p1: double): boolean
|
||||||
|
public final static method greater2(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method greater3(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method greater4(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method greater5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
public final class GreaterFloatKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method greater1(p0: float, p1: float): boolean
|
||||||
|
public final static method greater2(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method greater3(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method greater4(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method greater5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
public final class InlineKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method equals(@org.jetbrains.annotations.NotNull p0: java.lang.Comparable, @org.jetbrains.annotations.NotNull p1: java.lang.Comparable): boolean
|
||||||
|
public final static method equals754(p0: double, p1: double): boolean
|
||||||
|
public final static method equalsGeneric(@org.jetbrains.annotations.NotNull p0: java.lang.Comparable, p1: double): boolean
|
||||||
|
private final static method equalsReified(p0: java.lang.Comparable, p1: java.lang.Comparable): boolean
|
||||||
|
public final static method less(@org.jetbrains.annotations.NotNull p0: java.lang.Comparable, p1: double): boolean
|
||||||
|
public final static method less754(p0: double, p1: double): boolean
|
||||||
|
public final static method lessGeneric(@org.jetbrains.annotations.NotNull p0: java.lang.Comparable, p1: double): boolean
|
||||||
|
private final static method lessReified(p0: java.lang.Comparable, p1: double): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
public final class LessDoubleKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method less1(p0: double, p1: double): boolean
|
||||||
|
public final static method less2(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method less3(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method less4(@org.jetbrains.annotations.Nullable p0: java.lang.Double, @org.jetbrains.annotations.Nullable p1: java.lang.Double): boolean
|
||||||
|
public final static method less5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
public final class LessFloatKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static method less1(p0: float, p1: float): boolean
|
||||||
|
public final static method less2(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method less3(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method less4(@org.jetbrains.annotations.Nullable p0: java.lang.Float, @org.jetbrains.annotations.Nullable p1: java.lang.Float): boolean
|
||||||
|
public final static method less5(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
public final class NullableAnyToRealKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
public final class SafeCallKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
public final class SmartCastToDifferentTypesKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
public final class WhenKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
public final class WhenNoSubjectKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
+123
@@ -7761,6 +7761,129 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/ieee754")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Ieee754 extends AbstractIrBlackBoxCodegenTest {
|
||||||
|
public void testAllFilesPresentInIeee754() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ieee754"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anyToReal.kt")
|
||||||
|
public void testAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/anyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparableTypeCast.kt")
|
||||||
|
public void testComparableTypeCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/comparableTypeCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dataClass.kt")
|
||||||
|
public void testDataClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/dataClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsDouble.kt")
|
||||||
|
public void testEqualsDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsFloat.kt")
|
||||||
|
public void testEqualsFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsNullableDouble.kt")
|
||||||
|
public void testEqualsNullableDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsNullableDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitCompareCall.kt")
|
||||||
|
public void testExplicitCompareCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitCompareCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitEqualsCall.kt")
|
||||||
|
public void testExplicitEqualsCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitEqualsCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("generic.kt")
|
||||||
|
public void testGeneric() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/generic.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterDouble.kt")
|
||||||
|
public void testGreaterDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterFloat.kt")
|
||||||
|
public void testGreaterFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inline.kt")
|
||||||
|
public void testInline() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/inline.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessDouble.kt")
|
||||||
|
public void testLessDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessFloat.kt")
|
||||||
|
public void testLessFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableAnyToReal.kt")
|
||||||
|
public void testNullableAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/nullableAnyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("safeCall.kt")
|
||||||
|
public void testSafeCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/safeCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("smartCastToDifferentTypes.kt")
|
||||||
|
public void testSmartCastToDifferentTypes() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/smartCastToDifferentTypes.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("when.kt")
|
||||||
|
public void testWhen() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/when.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("whenNoSubject.kt")
|
||||||
|
public void testWhenNoSubject() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/whenNoSubject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/increment")
|
@TestMetadata("compiler/testData/codegen/box/increment")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
+57
@@ -291,6 +291,63 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxAga
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/boxAgainstJava/ieee754")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Ieee754 extends AbstractBlackBoxAgainstJavaCodegenTest {
|
||||||
|
public void testAllFilesPresentInIeee754() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/ieee754"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anyToReal.kt")
|
||||||
|
public void testAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/anyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparableTypeCast.kt")
|
||||||
|
public void testComparableTypeCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/comparableTypeCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("double.kt")
|
||||||
|
public void testDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/double.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitCompareCall.kt")
|
||||||
|
public void testExplicitCompareCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/explicitCompareCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitEqualsCall.kt")
|
||||||
|
public void testExplicitEqualsCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/explicitEqualsCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("float.kt")
|
||||||
|
public void testFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/float.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("generic.kt")
|
||||||
|
public void testGeneric() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/generic.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableAnyToReal.kt")
|
||||||
|
public void testNullableAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/ieee754/nullableAnyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxAgainstJava/innerClass")
|
@TestMetadata("compiler/testData/codegen/boxAgainstJava/innerClass")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
@@ -7761,6 +7761,129 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/ieee754")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Ieee754 extends AbstractBlackBoxCodegenTest {
|
||||||
|
public void testAllFilesPresentInIeee754() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ieee754"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anyToReal.kt")
|
||||||
|
public void testAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/anyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparableTypeCast.kt")
|
||||||
|
public void testComparableTypeCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/comparableTypeCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dataClass.kt")
|
||||||
|
public void testDataClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/dataClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsDouble.kt")
|
||||||
|
public void testEqualsDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsFloat.kt")
|
||||||
|
public void testEqualsFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsNullableDouble.kt")
|
||||||
|
public void testEqualsNullableDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsNullableDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitCompareCall.kt")
|
||||||
|
public void testExplicitCompareCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitCompareCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitEqualsCall.kt")
|
||||||
|
public void testExplicitEqualsCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitEqualsCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("generic.kt")
|
||||||
|
public void testGeneric() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/generic.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterDouble.kt")
|
||||||
|
public void testGreaterDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterFloat.kt")
|
||||||
|
public void testGreaterFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inline.kt")
|
||||||
|
public void testInline() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/inline.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessDouble.kt")
|
||||||
|
public void testLessDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessFloat.kt")
|
||||||
|
public void testLessFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableAnyToReal.kt")
|
||||||
|
public void testNullableAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/nullableAnyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("safeCall.kt")
|
||||||
|
public void testSafeCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/safeCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("smartCastToDifferentTypes.kt")
|
||||||
|
public void testSmartCastToDifferentTypes() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/smartCastToDifferentTypes.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("when.kt")
|
||||||
|
public void testWhen() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/when.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("whenNoSubject.kt")
|
||||||
|
public void testWhenNoSubject() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/whenNoSubject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/increment")
|
@TestMetadata("compiler/testData/codegen/box/increment")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
@@ -1215,6 +1215,51 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/bytecodeText/intrinsicsCompare")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class IntrinsicsCompare extends AbstractBytecodeTextTest {
|
||||||
|
public void testAllFilesPresentInIntrinsicsCompare() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/intrinsicsCompare"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("byteSmartCast.kt")
|
||||||
|
public void testByteSmartCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/intrinsicsCompare/byteSmartCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("charSmartCast.kt")
|
||||||
|
public void testCharSmartCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/intrinsicsCompare/charSmartCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("differentTypes.kt")
|
||||||
|
public void testDifferentTypes() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/intrinsicsCompare/differentTypes.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("intSmartCast.kt")
|
||||||
|
public void testIntSmartCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/intrinsicsCompare/intSmartCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("longSmartCast.kt")
|
||||||
|
public void testLongSmartCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/intrinsicsCompare/longSmartCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("shortSmartCast.kt")
|
||||||
|
public void testShortSmartCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/intrinsicsCompare/shortSmartCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeText/jackAndJill")
|
@TestMetadata("compiler/testData/codegen/bytecodeText/jackAndJill")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
+123
@@ -7761,6 +7761,129 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/ieee754")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Ieee754 extends AbstractLightAnalysisModeCodegenTest {
|
||||||
|
public void testAllFilesPresentInIeee754() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ieee754"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anyToReal.kt")
|
||||||
|
public void testAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/anyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparableTypeCast.kt")
|
||||||
|
public void testComparableTypeCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/comparableTypeCast.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dataClass.kt")
|
||||||
|
public void testDataClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/dataClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsDouble.kt")
|
||||||
|
public void testEqualsDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsFloat.kt")
|
||||||
|
public void testEqualsFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsNullableDouble.kt")
|
||||||
|
public void testEqualsNullableDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsNullableDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitCompareCall.kt")
|
||||||
|
public void testExplicitCompareCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitCompareCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitEqualsCall.kt")
|
||||||
|
public void testExplicitEqualsCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitEqualsCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("generic.kt")
|
||||||
|
public void testGeneric() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/generic.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterDouble.kt")
|
||||||
|
public void testGreaterDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterFloat.kt")
|
||||||
|
public void testGreaterFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inline.kt")
|
||||||
|
public void testInline() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/inline.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessDouble.kt")
|
||||||
|
public void testLessDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessFloat.kt")
|
||||||
|
public void testLessFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableAnyToReal.kt")
|
||||||
|
public void testNullableAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/nullableAnyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("safeCall.kt")
|
||||||
|
public void testSafeCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/safeCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("smartCastToDifferentTypes.kt")
|
||||||
|
public void testSmartCastToDifferentTypes() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/smartCastToDifferentTypes.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("when.kt")
|
||||||
|
public void testWhen() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/when.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("whenNoSubject.kt")
|
||||||
|
public void testWhenNoSubject() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/whenNoSubject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/increment")
|
@TestMetadata("compiler/testData/codegen/box/increment")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
@@ -931,11 +931,19 @@ public abstract class KotlinBuiltIns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFloat(@NotNull KotlinType type) {
|
public static boolean isFloat(@NotNull KotlinType type) {
|
||||||
return isConstructedFromGivenClassAndNotNullable(type, FQ_NAMES._float);
|
return isFloatOrNullableFloat(type) && !type.isMarkedNullable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFloatOrNullableFloat(@NotNull KotlinType type) {
|
||||||
|
return isConstructedFromGivenClass(type, FQ_NAMES._float);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDouble(@NotNull KotlinType type) {
|
public static boolean isDouble(@NotNull KotlinType type) {
|
||||||
return isConstructedFromGivenClassAndNotNullable(type, FQ_NAMES._double);
|
return isDoubleOrNullableDouble(type) && !type.isMarkedNullable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDoubleOrNullableDouble(@NotNull KotlinType type) {
|
||||||
|
return isConstructedFromGivenClass(type, FQ_NAMES._double);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isConstructedFromGivenClassAndNotNullable(@NotNull KotlinType type, @NotNull FqNameUnsafe fqName) {
|
private static boolean isConstructedFromGivenClassAndNotNullable(@NotNull KotlinType type, @NotNull FqNameUnsafe fqName) {
|
||||||
|
|||||||
+165
@@ -9328,6 +9328,171 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/box/ieee754")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Ieee754 extends AbstractJsCodegenBoxTest {
|
||||||
|
public void testAllFilesPresentInIeee754() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ieee754"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anyToReal.kt")
|
||||||
|
public void testAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/anyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("comparableTypeCast.kt")
|
||||||
|
public void testComparableTypeCast() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/comparableTypeCast.kt");
|
||||||
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dataClass.kt")
|
||||||
|
public void testDataClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/dataClass.kt");
|
||||||
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsDouble.kt")
|
||||||
|
public void testEqualsDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsFloat.kt")
|
||||||
|
public void testEqualsFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("equalsNullableDouble.kt")
|
||||||
|
public void testEqualsNullableDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/equalsNullableDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitCompareCall.kt")
|
||||||
|
public void testExplicitCompareCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitCompareCall.kt");
|
||||||
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitEqualsCall.kt")
|
||||||
|
public void testExplicitEqualsCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/explicitEqualsCall.kt");
|
||||||
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("generic.kt")
|
||||||
|
public void testGeneric() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/generic.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterDouble.kt")
|
||||||
|
public void testGreaterDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("greaterFloat.kt")
|
||||||
|
public void testGreaterFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/greaterFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inline.kt")
|
||||||
|
public void testInline() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/inline.kt");
|
||||||
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessDouble.kt")
|
||||||
|
public void testLessDouble() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessDouble.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lessFloat.kt")
|
||||||
|
public void testLessFloat() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/lessFloat.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableAnyToReal.kt")
|
||||||
|
public void testNullableAnyToReal() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/nullableAnyToReal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("safeCall.kt")
|
||||||
|
public void testSafeCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/safeCall.kt");
|
||||||
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("smartCastToDifferentTypes.kt")
|
||||||
|
public void testSmartCastToDifferentTypes() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/smartCastToDifferentTypes.kt");
|
||||||
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("when.kt")
|
||||||
|
public void testWhen() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/when.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("whenNoSubject.kt")
|
||||||
|
public void testWhenNoSubject() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ieee754/whenNoSubject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/increment")
|
@TestMetadata("compiler/testData/codegen/box/increment")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user