Getting default value from overriding method

This commit is contained in:
Valentin Kipyatkov
2015-05-21 22:26:46 +03:00
parent a7580d95e5
commit 5df840d9e3
4 changed files with 45 additions and 0 deletions
@@ -0,0 +1,17 @@
// "Replace with 'newFun(p1, p2, p3)'" "true"
interface I {
@deprecated("", ReplaceWith("newFun(p1, p2, p3)"))
fun oldFun(p1: String, p2: Int = 0, p3: Int = 1)
fun newFun(p1: String, p2: Int = 1, p3: Int = 1)
}
abstract class C : I {
override fun newFun(p1: String, p2: Int, p3: Int) { }
}
fun foo(c: C) {
c.<caret>oldFun("")
}
@@ -0,0 +1,17 @@
// "Replace with 'newFun(p1, p2, p3)'" "true"
interface I {
@deprecated("", ReplaceWith("newFun(p1, p2, p3)"))
fun oldFun(p1: String, p2: Int = 0, p3: Int = 1)
fun newFun(p1: String, p2: Int = 1, p3: Int = 1)
}
abstract class C : I {
override fun newFun(p1: String, p2: Int, p3: Int) { }
}
fun foo(c: C) {
c.<caret>newFun("", 0)
}