diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index f5d21564443..9688d55dfed 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -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 { diff --git a/compiler/testData/codegen/box/binaryOp/kt44402.kt b/compiler/testData/codegen/box/binaryOp/kt44402.kt new file mode 100644 index 00000000000..9ce890f3a37 --- /dev/null +++ b/compiler/testData/codegen/box/binaryOp/kt44402.kt @@ -0,0 +1,6 @@ +fun f(a: Double, b: B) = a == b + +fun box(): String { + if (f(0.1, 0.2)) return "FAIL" + return "OK" +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 261d14ecbf3..53a0e386c94 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -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 { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 09e979a755f..a25a954c734 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -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 { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index bc3096b6fbf..264f65f01a1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -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"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt index 08ae152f53c..bc57c873ba0 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.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 } \ No newline at end of file +fun KotlinType.shouldBeSubstituted() = contains { it is StubType || it.constructor is TypeVariableTypeConstructorMarker } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 5aba055ee81..fb2e84b3364 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -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"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 1e484daddfb..5bd9d8a6b6a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -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"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 3663d8c57fd..46ec2671d15 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -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"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 9ab988dd23d..ec3da7e2597 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -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");