f90b29c2e3
Previously, PartialBodyResolveFilter didn't know about contracts and was
filtering out calls of such functions, leading to unstable completion in
cases like that:
fun test(x: Any?) {
require(x is String)
x.<caret>
}
However, PartialBodyResolveFilter works by pure PSI, while to determine
if function has a contract we have to resolve it.
To solve it, we do something very similar to what has been done with
Nothin-returning functions: introduce
KotlinProbablyContractedFunctionShortNameIndex, which collects all
function which *may* have a contract during indexing.
^KT-25275 Fixed
24 lines
449 B
Plaintext
Vendored
24 lines
449 B
Plaintext
Vendored
Resolve target: val v2: kotlin.Int
|
|
----------------------------------------------
|
|
fun foo(p: Int) {
|
|
/* STATEMENT DELETED: x() */
|
|
|
|
val v1 = p * p
|
|
|
|
if (y()) {
|
|
val v2 = v1 * v1
|
|
/* STATEMENT DELETED: val v3 = v1 * v2 */
|
|
|
|
run {
|
|
val v2 = 1
|
|
println(v2)
|
|
}
|
|
|
|
print(<caret>v2)
|
|
|
|
/* STATEMENT DELETED: run { val v2 = 2 println(v2) } */
|
|
}
|
|
|
|
/* STATEMENT DELETED: z() */
|
|
}
|