Introduce inspection for safe cast + return #KT-26230 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-08-21 18:32:21 +03:00
committed by Mikhail Glukhikh
parent 2c71b3873e
commit 53c10238d6
20 changed files with 237 additions and 0 deletions
@@ -0,0 +1,11 @@
<html>
<body>
This inspection reports safe cast with 'return' should be replaced with 'if' type check. For example:
<br /><br />
<pre>
fun test(x: Any) {
<b>x as? String ?: return</b> // Should be replaced with '<b>if (x !is String) return</b>'
}
</pre>
</body>
</html>