Don't suggest cast when !! is possible #KT-18033 Fixed

This commit is contained in:
Dmitry Neverov
2017-05-24 07:42:06 +03:00
committed by Mikhail Glukhikh
parent af3a123c15
commit 0fd42bc747
3 changed files with 23 additions and 0 deletions
@@ -0,0 +1,15 @@
// "Cast expression 's' to 'String'" "false"
// ACTION: Add 'toString()' call
// ACTION: Add non-null asserted (!!) call
// ACTION: Change parameter 's' type of function 'bar' to 'String?'
// ACTION: Convert to expression body
// ACTION: Create function 'bar'
// ACTION: Surround with null check
// ACTION: Wrap with '?.let { ... }' call
// ERROR: Type mismatch: inferred type is String? but String was expected
fun foo(s: String?) {
bar(<caret>s)
}
fun bar(s: String){}