Fix default argument method calls

In some cases, calls of methods with default arguments were invoked via the
actual generated method, not via the "...$default" accessor
This commit is contained in:
Alexander Udalov
2013-09-03 19:57:15 +04:00
parent 329d724c1e
commit 723d5ef564
7 changed files with 74 additions and 7 deletions
@@ -0,0 +1,12 @@
var result = "Fail"
class A
fun A.plusAssign(a: A, s: String = "OK") {
result = s
}
fun box(): String {
A() += A()
return result
}
@@ -0,0 +1,14 @@
var result = "Fail"
class A
fun A.plus(a: A, s: String = "OK"): A {
result = s
return this
}
fun box(): String {
var a = A()
a += A()
return result
}
@@ -0,0 +1,3 @@
fun Int.foo(o: String, k: String = "K") = o + k
fun box() = 42 foo "O"
@@ -0,0 +1,5 @@
class A
fun A.plus(i: A, ok: String = "OK") = ok
fun box() = A() + A()
@@ -0,0 +1,5 @@
class A
fun A.contains(i: A, actual: Boolean = true) = actual
fun box() = if (A() in A()) "OK" else "Fail"