Files
openide/plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/IntroduceWhenSubject.html
Ilya Kirillov 3386f8f5a9 [kotlin] move inspection descriptions to separate module to reuse in K2
GitOrigin-RevId: e9d7382f4d640e27b1958d1bf2d4c3e639915137
2022-07-13 09:59:31 +00:00

26 lines
566 B
HTML

<html>
<body>
Reports a <code>when</code> expression that can be simplified by introducing a subject argument.
<p><b>Example:</b></p>
<pre><code>
fun test(obj: Any): String {
return when {
obj is String -> "string"
obj is Int -> "int"
else -> "unknown"
}
}
</code></pre>
<p>The quick fix introduces a subject argument:</p>
<pre><code>
fun test(obj: Any): String {
return when (obj) {
is String -> "string"
is Int -> "int"
else -> "unknown"
}
}
</code></pre>
</body>
</html>