Honor errors in code before when checking smart casts
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// 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()
|
||||
|
||||
var result: Any? = null
|
||||
<caret>for (s in list) {
|
||||
val a = s.length + (o as String).capitalize().hashCode()
|
||||
val x = a * o.length
|
||||
if (x > 1000) {
|
||||
result = x
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -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 }
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// 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
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user