d4b0688690
Before this commit we initialized delegate fields in primary constructor, that could provoke NPE in case delegate is used in initializer of some property backing field. Now we initialize delegate fields directly instead.
80 lines
1.4 KiB
Plaintext
Vendored
80 lines
1.4 KiB
Plaintext
Vendored
typealias Some = Function1<Any, String?>
|
|
object Factory {
|
|
private constructor() /* primary */ {
|
|
super/*Any*/()
|
|
/* <init>() */
|
|
|
|
}
|
|
|
|
fun foo(a: String): String {
|
|
return "Alpha"
|
|
}
|
|
|
|
fun foo(a: String, f: Function1<Any, String?>): String {
|
|
return "Omega"
|
|
}
|
|
|
|
}
|
|
|
|
interface Base {
|
|
|
|
}
|
|
|
|
interface Delegate : Base {
|
|
abstract fun bar()
|
|
|
|
}
|
|
|
|
interface Derived : Delegate {
|
|
|
|
}
|
|
|
|
data class DataClass : Derived, Delegate {
|
|
constructor(delegate: Delegate) /* primary */ {
|
|
super/*Any*/()
|
|
/* <init>() */
|
|
|
|
}
|
|
|
|
override fun bar() {
|
|
<this>.#<$$delegate_0>.bar()
|
|
}
|
|
|
|
local /* final field */ val <$$delegate_0>: Delegate = delegate
|
|
val delegate: Delegate
|
|
field = delegate
|
|
get
|
|
|
|
operator fun component1(): Delegate {
|
|
return <this>.#delegate
|
|
}
|
|
|
|
fun copy(delegate: Delegate = <this>.#delegate): DataClass {
|
|
return DataClass(delegate = delegate)
|
|
}
|
|
|
|
override fun equals(other: Any?): Boolean {
|
|
when {
|
|
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
|
|
}
|
|
when {
|
|
other !is DataClass -> return false
|
|
}
|
|
val tmp0_other_with_cast: DataClass = other as DataClass
|
|
when {
|
|
EQEQ(arg0 = <this>.#delegate, arg1 = tmp0_other_with_cast.#delegate).not() -> return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
override fun hashCode(): Int {
|
|
return <this>.#delegate.hashCode()
|
|
}
|
|
|
|
override fun toString(): String {
|
|
return "DataClass(" + "delegate=" + <this>.#delegate + ")"
|
|
}
|
|
|
|
}
|
|
|