From 0fdba4931509dbc2e707bf82184b1caf3d97b066 Mon Sep 17 00:00:00 2001 From: Michael Bogdanov Date: Thu, 24 Mar 2016 12:49:14 +0100 Subject: [PATCH] Test for KT-11514: Platform Double is converted to Int when comparing to Int literal #KT-11514 Fixed --- .../box/binaryOp/compareWithBoxedDouble.kt | 15 +++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 compiler/testData/codegen/box/binaryOp/compareWithBoxedDouble.kt diff --git a/compiler/testData/codegen/box/binaryOp/compareWithBoxedDouble.kt b/compiler/testData/codegen/box/binaryOp/compareWithBoxedDouble.kt new file mode 100644 index 00000000000..3c95aedf323 --- /dev/null +++ b/compiler/testData/codegen/box/binaryOp/compareWithBoxedDouble.kt @@ -0,0 +1,15 @@ +//FILE: Holder.java + +class Holder { + public Double value; + public Holder(Double value) { this.value = value; } +} + +//FILE: test.kt + +import Holder + +fun box(): String { + val j = Holder(0.99) + return if (j.value > 0) "OK" else "fail" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index f3dd58ec512..66cef1aec1b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -730,6 +730,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("compareWithBoxedDouble.kt") + public void testCompareWithBoxedDouble() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/binaryOp/compareWithBoxedDouble.kt"); + doTest(fileName); + } + @TestMetadata("compareWithBoxedLong.kt") public void testCompareWithBoxedLong() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/binaryOp/compareWithBoxedLong.kt");