Suspend call detector: fix delegated properties checking

This commit is contained in:
Mikhail Glukhikh
2017-12-07 11:46:04 +03:00
parent 24bd31457c
commit e503c1d411
9 changed files with 102 additions and 4 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.RedundantSuspendModifierInspection
@@ -0,0 +1,13 @@
// PROBLEM: none
// WITH_RUNTIME
import kotlin.reflect.KProperty
<caret>suspend fun bar(): String {
val x: String by Delegate()
return x
}
class Delegate {
suspend operator fun getValue(thisRef: Any?, property: KProperty<*>): String = ""
}
@@ -0,0 +1,16 @@
// PROBLEM: none
// WITH_RUNTIME
import kotlin.reflect.KProperty
<caret>suspend fun bar(): String {
var x: String by Delegate()
x = "Hello"
return x
}
class Delegate {
operator fun getValue(thisRef: Any?, property: KProperty<*>): String = ""
suspend operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
}