Files
kotlin-fork/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt
T
Alexander Udalov 8949ffbef1 Do not report deprecation on members of deprecated companion
This deprecation is reported on the companion itself anyway
2016-10-07 20:14:53 +03:00

33 lines
666 B
Kotlin
Vendored

class Another {
@Deprecated("Object")
companion object {
fun use() {}
const val USE = 42
}
}
fun first() {
<!DEPRECATION!>Another<!>.use()
Another.<!DEPRECATION!>Companion<!>.USE
<!DEPRECATION!>Another<!>.USE
}
fun useCompanion() {
val <!UNUSED_VARIABLE!>d<!> = <!DEPRECATION!>Another<!>
val <!UNUSED_VARIABLE!>x<!> = Another.<!DEPRECATION!>Companion<!>
Another.<!DEPRECATION!>Companion<!>.use()
<!DEPRECATION!>Another<!>.use()
}
@Deprecated("Some")
class Some {
companion object {
fun use() {}
}
}
fun some() {
<!DEPRECATION!>Some<!>.use()
<!DEPRECATION!>Some<!>.Companion.use()
}