UnnecessaryVariableInspection: fix false positive in lambda
#KT-32565 Fixed
This commit is contained in:
committed by
Yan Zhulanow
parent
64f6ed586b
commit
7c0af78b08
@@ -0,0 +1,16 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
fun findCredentials() = 1
|
||||
|
||||
fun println(i: Int) {}
|
||||
|
||||
fun test() {
|
||||
val data = run {
|
||||
val credentials = findCredentials()
|
||||
object {
|
||||
val <caret>foundCredentials = credentials
|
||||
}
|
||||
}
|
||||
|
||||
println(data.foundCredentials)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
fun findCredentials() = 1
|
||||
|
||||
fun println(i: Int) {}
|
||||
|
||||
fun test() {
|
||||
val data = run {
|
||||
val credentials = findCredentials()
|
||||
|
||||
class Foo {
|
||||
val <caret>foundCredentials = credentials
|
||||
}
|
||||
|
||||
Foo()
|
||||
}
|
||||
|
||||
val foundCredentials = data.foundCredentials
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
fun findCredentials() = 1
|
||||
|
||||
fun println(i: Int) {}
|
||||
|
||||
fun test() {
|
||||
val credentials = findCredentials()
|
||||
|
||||
val data = run {
|
||||
object {
|
||||
val <caret>foundCredentials = credentials
|
||||
}
|
||||
}
|
||||
|
||||
println(data.foundCredentials)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
fun findCredentials() = 1
|
||||
|
||||
fun println(i: Int) {}
|
||||
|
||||
fun test() {
|
||||
val credentials = findCredentials()
|
||||
|
||||
val data = run {
|
||||
object {
|
||||
}
|
||||
}
|
||||
|
||||
println(credentials)
|
||||
}
|
||||
Reference in New Issue
Block a user