Introduce inspection for safe cast + return #KT-26230 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
2c71b3873e
commit
53c10238d6
@@ -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>
|
||||
Reference in New Issue
Block a user