default -> companion: replace all mentions of default and default object
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class C() {
|
||||
default object {
|
||||
companion object {
|
||||
fun create() = C()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class C() {
|
||||
fun getInstance(): Runnable = C
|
||||
|
||||
default object: Runnable {
|
||||
companion object: Runnable {
|
||||
override fun run(): Unit {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ abstract open class Default {
|
||||
}
|
||||
|
||||
class MyInt() {
|
||||
default object : Default {
|
||||
companion object : Default {
|
||||
override fun defaultValue(): Int = 610
|
||||
}
|
||||
}
|
||||
|
||||
fun toDefault<T : Any>(t: T) where default object T : Default = T.defaultValue()
|
||||
fun toDefault<T : Any>(t: T) where class object T : Default = T.defaultValue()
|
||||
|
||||
fun box(): String = if (toDefault<MyInt>(MyInt()) == 610) "OK" else "fail"
|
||||
|
||||
Reference in New Issue
Block a user