KT-13884 Exception "Invalid root block PSI element" on replacing trivial when-expression to if
#KT-13884 Fixed
This commit is contained in:
+1
@@ -33,6 +33,7 @@ class WhenToIfIntention : SelfTargetingRangeIntention<KtWhenExpression>(KtWhenEx
|
||||
if (entries.isEmpty()) return null
|
||||
val lastEntry = entries.last()
|
||||
if (entries.any { it != lastEntry && it.isElse }) return null
|
||||
if (entries.all { it.isElse }) return null // 'when' with only 'else' branch is not supported
|
||||
return element.whenKeyword.textRange
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user