Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/chooseCallableReferenceDependingOnInferredReceiver.kt
T
2020-03-19 09:51:01 +03:00

34 lines
527 B
Kotlin
Vendored

class A {
fun foo(i: A) {}
fun baz(i: A) {}
}
class B {
fun foo(s: B) {}
fun foo(c: Char) {}
fun baz(s: B) {}
}
fun <T> bar(f: (T) -> Unit): T = TODO()
fun test() {
myWith(A()) {
val t1 = bar(::foo)
val t2 = bar(::baz)
myWith(B()) {
val a: A = bar(::foo)
val b: B = bar(::foo)
val t3 = bar(::baz)
bar(<!UNRESOLVED_REFERENCE!>::foo<!>)
}
}
}
inline fun <T, R> myWith(receiver: T, block: T.() -> R): R = TODO()