Files
kotlin-fork/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt
T
Alexander Udalov 51684b3fe1 Drop "Reflection types not loaded" diagnostic
Reflection types are now considered to be built-in, so their absence means the
runtime is broken and the compiler can't work at all; this condition probably
should be handled on another level for all built-in types
2015-05-26 14:27:39 +03:00

49 lines
1.3 KiB
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_EXPRESSION
class UsefulClass(val param: Int = 2) {
fun get(instance: Any, property: PropertyMetadata) : Int = 1
fun set(instance: Any, property: PropertyMetadata, value: Int) {}
deprecated("message")
fun member() {}
}
deprecated("message")
fun Obsolete(param: Int = 1): UsefulClass = UsefulClass(param)
class Invocable {
deprecated("message")
fun invoke() {}
}
object InvocableHolder {
val invocable = Invocable()
}
fun invoker() {
val invocable = Invocable()
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>invocable<!>()
InvocableHolder.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>invocable<!>()
}
fun block() {
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>(2)
}
fun expression() = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
fun reflection() = ::<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>
fun reflection2() = UsefulClass::<!DEPRECATED_SYMBOL_WITH_MESSAGE!>member<!>
class Initializer {
val x = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
}
deprecated("does nothing good")
fun Any.doNothing() = this.toString() // "this" should not be marked as deprecated despite it referes to deprecated function
class Delegation {
val x by <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
var y by <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
}