[JVM IR] Make upper bounds check recursive for ieee Equals.
Fixes KT-44402
This commit is contained in:
committed by
Alexander Udalov
parent
566f97ae3e
commit
965c118521
+6
@@ -1442,6 +1442,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun <A: Double, B: A> f(a: Double, b: B) = a == b
|
||||
|
||||
fun box(): String {
|
||||
if (f(0.1, 0.2)) return "FAIL"
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -1442,6 +1442,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
|
||||
+6
@@ -1442,6 +1442,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
|
||||
+5
@@ -1276,6 +1276,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt6747_identityEquals.kt");
|
||||
|
||||
@@ -81,7 +81,9 @@ fun KotlinType.isPrimitiveNumberOrNullableType(): Boolean =
|
||||
fun KotlinType.isTypeParameter(): Boolean = TypeUtils.isTypeParameter(this)
|
||||
|
||||
fun KotlinType.upperBoundedByPrimitiveNumberOrNullableType(): Boolean =
|
||||
TypeUtils.getTypeParameterDescriptorOrNull(this)?.upperBounds?.any { it.isPrimitiveNumberOrNullableType() } == true
|
||||
TypeUtils.getTypeParameterDescriptorOrNull(this)?.upperBounds?.any {
|
||||
it.isPrimitiveNumberOrNullableType() || it.upperBoundedByPrimitiveNumberOrNullableType()
|
||||
} == true
|
||||
|
||||
fun KotlinType.isInterface(): Boolean = (constructor.declarationDescriptor as? ClassDescriptor)?.kind == ClassKind.INTERFACE
|
||||
fun KotlinType.isEnum(): Boolean = (constructor.declarationDescriptor as? ClassDescriptor)?.kind == ClassKind.ENUM_CLASS
|
||||
@@ -306,4 +308,4 @@ private fun NewCapturedType.unCaptureTopLevelType(): UnwrappedType {
|
||||
return constructor.projection.type.unwrap()
|
||||
}
|
||||
|
||||
fun KotlinType.shouldBeSubstituted() = contains { it is StubType || it.constructor is TypeVariableTypeConstructorMarker }
|
||||
fun KotlinType.shouldBeSubstituted() = contains { it is StubType || it.constructor is TypeVariableTypeConstructorMarker }
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -821,6 +821,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt6747_identityEquals.kt");
|
||||
|
||||
Generated
+5
@@ -821,6 +821,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt6747_identityEquals.kt");
|
||||
|
||||
Generated
+5
@@ -821,6 +821,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt6747_identityEquals.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -711,6 +711,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt23030_properIeee754comparisons.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44402.kt")
|
||||
public void testKt44402() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt44402.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6747_identityEquals.kt")
|
||||
public void testKt6747_identityEquals() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/binaryOp/kt6747_identityEquals.kt");
|
||||
|
||||
Reference in New Issue
Block a user