diff --git a/compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt b/compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt index 855b15f1be6..fd62573c2bd 100644 --- a/compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt +++ b/compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt @@ -1,7 +1,5 @@ // !LANGUAGE: +ProperIeee754Comparisons -// IGNORE_BACKEND: JS // IGNORE_BACKEND_FIR: JVM_IR -// ^ if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)") fun eq_double_doubleN(a: Double, b: Double?) = a == b @@ -22,10 +20,8 @@ fun box(): String { if (eq_double_doubleN(0.0, null)) throw AssertionError("eq_double_doubleN(0.0, null)") if (!eq_double_any(0.0, 0.0)) throw AssertionError("!eq_double_any(0.0, 0.0)") if (eq_double_any(0.0, -0.0)) throw AssertionError("eq_double_any(0.0, -0.0)") - if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)") if (!eq_double_anyN(0.0, 0.0)) throw AssertionError("!eq_double_anyN(0.0, 0.0)") if (eq_double_anyN(0.0, -0.0)) throw AssertionError("eq_double_anyN(0.0, -0.0)") - if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)") if (eq_double_anyN(0.0, null)) throw AssertionError("eq_double_anyN(0.0, null)") if (eq_doubleN_double(null, 0.0)) throw AssertionError("eq_doubleN_double(null, 0.0)") @@ -33,10 +29,8 @@ fun box(): String { if (eq_doubleN_doubleN(0.0, null)) throw AssertionError("eq_doubleN_doubleN(0.0, null)") if (!eq_doubleN_any(0.0, 0.0)) throw AssertionError("!eq_doubleN_any(0.0, 0.0)") if (eq_doubleN_any(0.0, -0.0)) throw AssertionError("eq_doubleN_any(0.0, -0.0)") - if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)") if (!eq_doubleN_anyN(0.0, 0.0)) throw AssertionError("!eq_doubleN_anyN(0.0, 0.0)") if (eq_doubleN_anyN(0.0, -0.0)) throw AssertionError("eq_doubleN_anyN(0.0, -0.0)") - if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)") if (eq_doubleN_anyN(0.0, null)) throw AssertionError("eq_doubleN_anyN(0.0, null)") return "OK" diff --git a/compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt b/compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt new file mode 100644 index 00000000000..fbd0165c7b9 --- /dev/null +++ b/compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt @@ -0,0 +1,21 @@ +// !LANGUAGE: +ProperIeee754Comparisons +// It doesn't work on JS due to how numbers are represented, but it could be changed in the future. +// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS_IR + +fun eq_double_any(a: Double, b: Any) = a == b + +fun eq_double_anyN(a: Double, b: Any?) = a == b + +fun eq_doubleN_any(a: Double?, b: Any) = a == b + +fun eq_doubleN_anyN(a: Double?, b: Any?) = a == b + +fun box(): String { + if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)") + if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)") + if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)") + if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt b/compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt new file mode 100644 index 00000000000..53059a1a412 --- /dev/null +++ b/compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt @@ -0,0 +1,22 @@ +// !LANGUAGE: +ProperIeee754Comparisons +// It doesn't work on JS due to how numbers are represented, but it could be changed in the future. +// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun eq_double_any(a: A, b: B) = a == b + +fun eq_double_anyN(a: A, b: B) = a == b + +fun eq_doubleN_any(a: A, b: B) = a == b + +fun eq_doubleN_anyN(a: A, b: B) = a == b + +fun box(): String { + if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)") + if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)") + if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)") + if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)") + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt b/compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt index 4ac73d9f4f6..14ccea99a90 100644 --- a/compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt +++ b/compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt @@ -1,7 +1,5 @@ // !LANGUAGE: +ProperIeee754Comparisons -// IGNORE_BACKEND: JS // IGNORE_BACKEND_FIR: JVM_IR -// ^ if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)") fun eq_double_doubleN(a: A, b: B) = a == b @@ -22,10 +20,8 @@ fun box(): String { if (eq_double_doubleN(0.0, null)) throw AssertionError("eq_double_doubleN(0.0, null)") if (!eq_double_any(0.0, 0.0)) throw AssertionError("!eq_double_any(0.0, 0.0)") if (eq_double_any(0.0, -0.0)) throw AssertionError("eq_double_any(0.0, -0.0)") - if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)") if (!eq_double_anyN(0.0, 0.0)) throw AssertionError("!eq_double_anyN(0.0, 0.0)") if (eq_double_anyN(0.0, -0.0)) throw AssertionError("eq_double_anyN(0.0, -0.0)") - if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)") if (eq_double_anyN(0.0, null)) throw AssertionError("eq_double_anyN(0.0, null)") if (eq_doubleN_double(null, 0.0)) throw AssertionError("eq_doubleN_double(null, 0.0)") @@ -33,10 +29,8 @@ fun box(): String { if (eq_doubleN_doubleN(0.0, null)) throw AssertionError("eq_doubleN_doubleN(0.0, null)") if (!eq_doubleN_any(0.0, 0.0)) throw AssertionError("!eq_doubleN_any(0.0, 0.0)") if (eq_doubleN_any(0.0, -0.0)) throw AssertionError("eq_doubleN_any(0.0, -0.0)") - if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)") if (!eq_doubleN_anyN(0.0, 0.0)) throw AssertionError("!eq_doubleN_anyN(0.0, 0.0)") if (eq_doubleN_anyN(0.0, -0.0)) throw AssertionError("eq_doubleN_anyN(0.0, -0.0)") - if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)") if (eq_doubleN_anyN(0.0, null)) throw AssertionError("eq_doubleN_anyN(0.0, null)") return "OK" diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index eb7c5788d7d..bf5a15657d8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -1121,6 +1121,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt"); } + @TestMetadata("eqNullableDoublesToInt.kt") + public void testEqNullableDoublesToInt() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt"); + } + + @TestMetadata("eqNullableDoublesToIntWithTP.kt") + public void testEqNullableDoublesToIntWithTP() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt"); + } + @TestMetadata("eqNullableDoublesWithTP.kt") public void testEqNullableDoublesWithTP() throws Exception { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index fcd08a3ebdf..97caa7c9b40 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -1121,6 +1121,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt"); } + @TestMetadata("eqNullableDoublesToInt.kt") + public void testEqNullableDoublesToInt() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt"); + } + + @TestMetadata("eqNullableDoublesToIntWithTP.kt") + public void testEqNullableDoublesToIntWithTP() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt"); + } + @TestMetadata("eqNullableDoublesWithTP.kt") public void testEqNullableDoublesWithTP() throws Exception { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt"); @@ -14705,6 +14715,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class NotNullAssertions extends AbstractLightAnalysisModeTest { + @TestMetadata("paramAssertionMessage.kt") + public void ignoreParamAssertionMessage() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt"); + } + private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -14793,11 +14808,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullableTypeParameter.kt"); } - @TestMetadata("paramAssertionMessage.kt") - public void testParamAssertionMessage() throws Exception { - runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt"); - } - @TestMetadata("staticCallErrorMessage.kt") public void testStaticCallErrorMessage() throws Exception { runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt"); @@ -21255,11 +21265,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNullFailFast.kt"); } - @TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt") - public void ignoreJavaArrayOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception { - runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt"); - } - @TestMetadata("javaCollectionOfExplicitNotNullFailFast.kt") public void ignoreJavaCollectionOfExplicitNotNullFailFast() throws Exception { runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt"); @@ -21270,11 +21275,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNullFailFast.kt"); } - @TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt") - public void ignoreJavaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception { - runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt"); - } - @TestMetadata("javaCollectionOfNotNullToTypedArrayFailFast.kt") public void ignoreJavaCollectionOfNotNullToTypedArrayFailFast() throws Exception { runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt"); @@ -21308,6 +21308,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariable.kt"); } + @TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt") + public void testJavaArrayOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception { + runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt"); + } + @TestMetadata("javaCollectionOfExplicitNotNull.kt") public void testJavaCollectionOfExplicitNotNull() throws Exception { runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt"); @@ -21333,6 +21338,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt"); } + @TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt") + public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception { + runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt"); + } + @TestMetadata("javaCollectionOfNotNullFromStdlib.kt") public void testJavaCollectionOfNotNullFromStdlib() throws Exception { runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlib.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 20e06673d6e..c4963bf70e9 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -1101,6 +1101,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt"); } + @TestMetadata("eqNullableDoublesToInt.kt") + public void testEqNullableDoublesToInt() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt"); + } + + @TestMetadata("eqNullableDoublesToIntWithTP.kt") + public void testEqNullableDoublesToIntWithTP() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt"); + } + @TestMetadata("eqNullableDoublesWithTP.kt") public void testEqNullableDoublesWithTP() throws Exception { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index b29f7b78a4b..e12ba2fea59 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -1101,6 +1101,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt"); } + @TestMetadata("eqNullableDoublesToInt.kt") + public void testEqNullableDoublesToInt() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt"); + } + + @TestMetadata("eqNullableDoublesToIntWithTP.kt") + public void testEqNullableDoublesToIntWithTP() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt"); + } + @TestMetadata("eqNullableDoublesWithTP.kt") public void testEqNullableDoublesWithTP() throws Exception { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index d79440211b4..5ec1984b1f0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -761,6 +761,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt"); } + @TestMetadata("eqNullableDoublesToInt.kt") + public void testEqNullableDoublesToInt() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt"); + } + + @TestMetadata("eqNullableDoublesToIntWithTP.kt") + public void testEqNullableDoublesToIntWithTP() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt"); + } + @TestMetadata("eqNullableDoublesWithTP.kt") public void testEqNullableDoublesWithTP() throws Exception { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 3e52472bf6e..ccb5d6ce91b 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -761,6 +761,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoubles.kt"); } + @TestMetadata("eqNullableDoublesToInt.kt") + public void testEqNullableDoublesToInt() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToInt.kt"); + } + + @TestMetadata("eqNullableDoublesToIntWithTP.kt") + public void testEqNullableDoublesToIntWithTP() throws Exception { + runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesToIntWithTP.kt"); + } + @TestMetadata("eqNullableDoublesWithTP.kt") public void testEqNullableDoublesWithTP() throws Exception { runTest("compiler/testData/codegen/box/binaryOp/eqNullableDoublesWithTP.kt");