ae902e6fe5
Previously the callee reference of a delegated constructor call is always the same as the call itself. This violates the contract that no two FIR elements can have identical sources. In addition, this sets the entire call expression as the source of the callee expression. This change instead sets the proper constructor ref as the callee. Also fixed EXPLICIT_DELEGATION_CALL_REQUIRED type. It should be an error instead of a warning.
30 lines
490 B
Kotlin
Vendored
30 lines
490 B
Kotlin
Vendored
package toplevelObjectDeclarations
|
|
|
|
open class Foo(y : Int) {
|
|
open fun foo() : Int = 1
|
|
}
|
|
|
|
<!INAPPLICABLE_CANDIDATE!>class T : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> {}<!>
|
|
|
|
<!INAPPLICABLE_CANDIDATE!>object A : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> {
|
|
val x : Int = 2
|
|
|
|
fun test() : Int {
|
|
return x + foo()
|
|
}
|
|
}<!>
|
|
|
|
object B : A {}
|
|
|
|
val x = A.foo()
|
|
|
|
val y = object : Foo(x) {
|
|
init {
|
|
x + 12
|
|
}
|
|
|
|
override fun foo() : Int = 1
|
|
}
|
|
|
|
val z = y.foo()
|