Files
kotlin-fork/compiler/testData/codegen/box/fullJdk/kt46540.kt
T
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01:00

34 lines
881 B
Kotlin
Vendored

// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
// 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"
}