Files
kotlin-fork/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

56 lines
950 B
Kotlin
Vendored

package bar
// should be thrown away
fun <R> List<R>.a() {}
fun test1(i: Int?) {
1.<!INAPPLICABLE_CANDIDATE!>a<!>()
i.<!INAPPLICABLE_CANDIDATE!>a<!>()
}
fun <R> test2(c: Collection<R>) {
c.<!INAPPLICABLE_CANDIDATE!>a<!>()
}
fun Int.foo() {}
fun test3(s: String?) {
"".<!INAPPLICABLE_CANDIDATE!>foo<!>()
s.<!INAPPLICABLE_CANDIDATE!>foo<!>()
"".foo(<!TOO_MANY_ARGUMENTS!>1<!>)
s.foo(<!TOO_MANY_ARGUMENTS!>"a"<!>)
}
interface A
fun <T: A> T.c() {}
fun test4() {
1.<!INAPPLICABLE_CANDIDATE!>c<!>()
}
// should be an error on receiver, shouldn't be thrown away
fun test5() {
1.(<!UNRESOLVED_REFERENCE!>fun String.()=1<!>)()
}
fun <R: Any> R?.sure() : R = this!!
fun <T> test6(l: List<T>?) {
l.<!INAPPLICABLE_CANDIDATE!>sure<!><T>()
}
fun List<String>.b() {}
fun test7(l: List<String?>) {
l.<!INAPPLICABLE_CANDIDATE!>b<!>()
}
fun test8(l: List<Any>?) {
l.<!INAPPLICABLE_CANDIDATE!>b<!>()
}