[FIR-TEST] Add new testdata generated after changes in previous commit

This commit is contained in:
Dmitriy Novozhilov
2019-12-11 16:16:22 +03:00
parent e9c02a1cca
commit 2536fa0cd5
4578 changed files with 104067 additions and 1 deletions
@@ -0,0 +1,42 @@
class Bar(val gav: String)
class Foo(val bar: Bar, val nbar: Bar?) {
fun baz(s: String) = if (s != "") Bar(s) else null
}
fun String?.call(f: (String?) -> String?) = f(this)
fun String.notNullLet(f: (String) -> Unit) = f(this)
fun test(foo: Foo?) {
foo?.bar?.gav.let {
// Error, foo?.bar?.gav is nullable
it.<!INAPPLICABLE_CANDIDATE!>length<!>
// Error, foo is nullable
foo.<!INAPPLICABLE_CANDIDATE!>bar<!>.<!UNRESOLVED_REFERENCE!>gav<!>.<!UNRESOLVED_REFERENCE!>length<!>
// Correct
foo?.bar?.gav?.length
}
foo?.bar?.gav.call { it }?.notNullLet {
foo.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
foo.<!INAPPLICABLE_CANDIDATE!>bar<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
}
}
fun testNotNull(foo: Foo) {
val s: String? = ""
foo.baz(s!!)?.gav.let {
it.<!INAPPLICABLE_CANDIDATE!>length<!>
// Ok because of foo.
s.length.hashCode()
}
}
fun testNullable(foo: Foo?) {
val s: String? = ""
foo?.baz(s!!)?.gav.let {
it.<!INAPPLICABLE_CANDIDATE!>length<!>
// Ok because of foo?.
s?.length?.hashCode()
}
}