Preliminary support for extension functions: they participate in overload resolution only if no such name is found in the receiver type itself.

This commit is contained in:
Andrey Breslav
2011-05-19 00:06:01 +04:00
parent 25799cf2f0
commit 00e2c9dde3
15 changed files with 192 additions and 20 deletions
@@ -0,0 +1,21 @@
fun <~T~T, ~E~E> `T`T.foo(x : `E`E, y : `A`A) : `T`T {
y.`+`plus(1)
y `+`plus 1
y `+1`+ 1.0
this?.`-`minus<T>(this)
this
}
~A~class A
~+1~fun `A`A.plus(a : Any) {
1
}
~+~fun `A`A.plus(a : Int) {
1
}
~-~fun <T> T.minus(t : T) : Int = 1