Fix NPE in suspension point in monitor call checker

#KT-27484 Fixed
This commit is contained in:
Ilmir Usmanov
2018-10-10 16:22:12 +03:00
parent 36c73eedbf
commit c4d0b5493a
3 changed files with 20 additions and 1 deletions
@@ -42,7 +42,8 @@ class SuspensionPointInSynchronizedCallChecker : CallChecker {
if (parent !is KtValueArgumentList) {
child = parent
}
parent = parent.parent
// parent.parent can be null if we edit the file, see EA-2158254 and KT-27484
parent = parent.parent ?: return
}
}
@@ -0,0 +1,13 @@
inline val C.v: Int get() = 1
class C {
fun f(block: suspend C.() -> Unit): Unit = TODO()
}
suspend fun yield() = {}
fun f(c: C) {
c.f {
v.toString()
yie<caret>
}
}
// EXIST: yield
@@ -359,6 +359,11 @@ public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJ
runTest("idea/idea-completion/testData/basic/multifile/StaticMembersOfNotImportedClassNameConflict/");
}
@TestMetadata("SuspensionPointInMonitor")
public void testSuspensionPointInMonitor() throws Exception {
runTest("idea/idea-completion/testData/basic/multifile/SuspensionPointInMonitor/");
}
@TestMetadata("SyntheticExtensionDeprecated")
public void testSyntheticExtensionDeprecated() throws Exception {
runTest("idea/idea-completion/testData/basic/multifile/SyntheticExtensionDeprecated/");