Add inspection to detect is checks for object types #KT-21741 Fixed

This commit is contained in:
Toshiaki Kameyama
2017-12-18 12:14:34 +03:00
committed by Mikhail Glukhikh
parent 247881baf9
commit 84a6ef6ac4
15 changed files with 228 additions and 0 deletions
@@ -379,6 +379,11 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
return whenEntry
}
fun createWhenCondition(conditionText: String): KtWhenCondition {
val whenEntry = createWhenEntry("$conditionText -> {}")
return whenEntry.conditions[0]
}
fun createBlockStringTemplateEntry(expression: KtExpression): KtStringTemplateEntryWithExpression {
// We don't want reformatting here as it can potentially change something in raw strings
val stringTemplateExpression = createExpressionByPattern("\"$\${$0}\"", expression, reformat = false) as KtStringTemplateExpression