d91000e39c
... instead of just UNRESOLVED_REFERENCE when something went wrong during resolution. #KT-59401 related
32 lines
854 B
Kotlin
Vendored
32 lines
854 B
Kotlin
Vendored
// !CHECK_TYPE
|
|
// !LANGUAGE: +CallableReferencesToClassMembersWithEmptyLHS
|
|
|
|
import kotlin.reflect.KFunction0
|
|
|
|
fun expectFunction0Unit(f: () -> Unit) = f
|
|
fun expectFunction0String(f: () -> String) = f
|
|
fun expectFunction1Unit(f: (A) -> Unit) = f
|
|
fun expectFunction1String(f: (A) -> String) = f
|
|
|
|
fun foo(): String = ""
|
|
|
|
class A {
|
|
fun foo() {}
|
|
|
|
fun main() {
|
|
val x = ::foo
|
|
|
|
checkSubtype<KFunction0<Unit>>(x)
|
|
|
|
expectFunction0Unit(x)
|
|
expectFunction0String(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
|
|
expectFunction1Unit(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
|
|
expectFunction1String(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
|
|
|
|
expectFunction0Unit(::foo)
|
|
expectFunction0String(::foo)
|
|
expectFunction1Unit(::<!INAPPLICABLE_CANDIDATE!>foo<!>)
|
|
expectFunction1String(::<!INAPPLICABLE_CANDIDATE!>foo<!>)
|
|
}
|
|
}
|