Files
kotlin-fork/compiler/testData/codegen/box/intrinsics/kt5937.kt
T
Juan Chen 4f6fe1d0ca [FIR]: fix translation of top-level property accesses like array.indices
This commit addresses the following issues:

* accessors didn't take into account their property's receiver type,
which caused NoSuchMethod due to signature mismatch. Now the property's
receiver type is passed to Fir2Ir translation of accessors.

* property's parent was not class, e.g., kotlin.collections.indices.
Now the symbol table collects WrappedPropertyDescriptorWithContainerSource
besides WrappedFunctionDescriptorWithContainerSource, so that
facade classes for such properties can be generated before codegen.

* accessor's parent was not class. Now the containerSource of
the property descriptor is passed to accessor descriptor.
2020-02-25 12:13:42 +03:00

34 lines
649 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_RUNTIME
var result = "Fail"
var l = 10L
var d = 10.0
var i = 10
fun foo(): Int {
result = "OK"
return 1
}
fun box(): String {
val javaClass = foo().javaClass
if (javaClass != 1.javaClass) return "fail 1"
val lv = 3L
if (2L.javaClass != lv.javaClass) return "fail 2"
if (2L.javaClass != l.javaClass) return "fail 3"
val dv = 3.0
if (2.0.javaClass != dv.javaClass) return "fail 4"
if (2.0.javaClass != d.javaClass) return "fail 5"
val iv = 3
if (2.javaClass != iv.javaClass) return "fail 6"
if (2.javaClass != i.javaClass) return "fail 7"
return result
}