Files
kotlin-fork/compiler/testData/diagnostics/tests/extensions/kt1875.fir.kt
T
Dmitriy Novozhilov f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00

22 lines
561 B
Kotlin
Vendored

//KT-1875 Safe call should be binded with receiver or this object (but not with both by default)
package kt1875
fun foo(a : Int?, b : Int.(Int)->Int) = a?.b(1) //unnecessary safe call warning
interface T {
val f : ((i: Int) -> Unit)?
}
fun test(t: T) {
t.<!INAPPLICABLE_CANDIDATE!>f<!>(1) //unsafe call error
t.f?.invoke(1)
}
fun test1(t: T?) {
t.<!UNRESOLVED_REFERENCE!>f<!>(1) // todo resolve f as value and report UNSAFE_CALL
t?.<!INAPPLICABLE_CANDIDATE!>f<!>(1)
t.<!INAPPLICABLE_CANDIDATE!>f<!>?.invoke(1)
t?.f?.invoke(1)
}