[JVM IR] Fix constant folding to use basic types always.

Fixes KT-46540.
This commit is contained in:
Mads Ager
2021-05-10 15:08:54 +02:00
committed by Alexander Udalov
parent ad18d5984b
commit 2c5a4dcb98
6 changed files with 63 additions and 11 deletions
+30
View File
@@ -0,0 +1,30 @@
// TARGET_BACKEND: JVM
// SKIP_JDK6
// FULL_JDK
import java.util.function.Supplier
class A {
val xLong: Supplier<Long>
get() = Supplier { 30 * 30 }
val xShort: Supplier<Short>
get() = Supplier { 30 * 30 }
val xInt: Supplier<Int>
get() = Supplier { 30 * 30 }
val xByte: Supplier<Byte>
get() = Supplier { 3 * 3 }
}
fun box(): String {
val a = A()
if (a.xLong.get() != 900L) return "FAIL1"
var expectedShort: Short = 900
if (a.xShort.get() != expectedShort) return "FAIL2"
if (a.xInt.get() != 900) return "FAIL3"
val expectedByte: Byte = 9
if (a.xByte.get() != expectedByte) return "FAIL4"
return "OK"
}