Unused symbol: fix false positive in anonymous object in top level or companion object

#KT-31800 Fixed
#KT-20868 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-02-10 13:38:16 +09:00
committed by Vladimir Dolzhenko
parent ef1e54eda9
commit a3252b9480
10 changed files with 106 additions and 0 deletions
@@ -0,0 +1,16 @@
// PROBLEM: none
// WITH_RUNTIME
private val xs = listOf(1, 2, 3).flatMap { x ->
listOf(3, 4, 5).map { y ->
object {
val <caret>value = x + y
}
}
}
fun foo() {
xs.forEach {
println("value: " + it.value)
}
}
@@ -0,0 +1,13 @@
// PROBLEM: none
class Some {
fun bar() {
writer().sayHello()
}
companion object {
private fun writer() = object {
fun <caret>sayHello() {
}
}
}
}
@@ -0,0 +1,9 @@
// PROBLEM: none
fun main() {
writer.sayHello()
}
private val writer = object {
fun <caret>sayHello() {
}
}