Files
kotlin-fork/compiler/testData/codegen/box/casts/functions/isFunKSmall.kt
T
Mikhail Glukhikh 20c4a7b244 [FIR2IR] Introduce staged transformation (first step)
Now FE IR -> BE IR transformation is performed in multiple stages
controller by Fir2IrConverter. Stages are
 * files & classes registration
 * supertypes & type parameters handling
 * functions & properties signature generation
 * body generation

After each step we have guarantee (with exception of local classes &
type inference combination, and external symbols) that required symbols
(class/function/property/variable/type parameter)
are already bound to real declarations and have correct parents.

This commit also fixes incorrect parents for local classes
2020-03-13 12:18:02 +03:00

62 lines
1.9 KiB
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
fun fn0() {}
fun fn1(x: Any) {}
val lambda0 = {} as () -> Unit
val lambda1 = { x: Any -> } as (Any) -> Unit
fun Any.extFun() {}
var Any.extProp: String
get() = "extProp"
set(x: String) {}
class A {
fun foo() {}
}
fun box(): String {
val f0 = ::fn0 as Any
val f1 = ::fn1 as Any
val ef = Any::extFun as Any
val epg = Any::extProp.getter
val eps = Any::extProp.setter
val afoo = A::foo
fun local0() {}
fun local1(x: Any) {}
val localFun0 = ::local0 as Any
val localFun1 = ::local1 as Any
assert(f0 is Function0<*>) { "Failed: f0 is Function0<*>" }
assert(f1 is Function1<*, *>) { "Failed: f1 is Function1<*, *>" }
assert(f0 !is Function1<*, *>) { "Failed: f0 !is Function1<*, *>" }
assert(f1 !is Function0<*>) { "Failed: f1 !is Function0<*>" }
assert(lambda0 is Function0<*>) { "Failed: lambda0 is Function0<*>" }
assert(lambda1 is Function1<*, *>) { "Failed: lambda1 is Function1<*, *>" }
assert(lambda0 !is Function1<*, *>) { "Failed: lambda0 !is Function1<*, *>" }
assert(lambda1 !is Function0<*>) { "Failed: lambda1 !is Function0<*>" }
assert(localFun0 is Function0<*>) { "Failed: localFun0 is Function0<*>" }
assert(localFun1 is Function1<*, *>) { "Failed: localFun1 is Function1<*, *>" }
assert(localFun0 !is Function1<*, *>) { "Failed: localFun0 !is Function1<*, *>" }
assert(localFun1 !is Function0<*>) { "Failed: localFun1 !is Function0<*>" }
assert(ef is Function1<*, *>) { "Failed: ef is Function1<*, *>" }
assert(epg is Function1<*, *>) { "Failed: epg is Function1<*, *>"}
assert(eps is Function2<*, *, *>) { "Failed: eps is Function2<*, *, *>"}
assert(afoo is Function1<*, *>) { "afoo is Function1<*, *>" }
return "OK"
}