Honor errors in code before when checking smart casts

This commit is contained in:
Valentin Kipyatkov
2016-10-15 22:46:52 +03:00
parent eae23b548f
commit 9326dfa048
6 changed files with 76 additions and 2 deletions
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// ERROR: Unresolved reference: unresolvedFun
// INTENTION_TEXT: "Replace with 'map{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.map{}.firstOrNull{}'"
fun foo(list: List<String>, o: Any) {
if (o is CharSequence) {
unresolvedFun()
val result: Any? = list
.map { it.length + (o as String).capitalize().hashCode() }
.map { it * o.length }
.firstOrNull { it > 1000 }
}
}