JET-49 Resolve extension functions with generic receivers
+ Error report fixed for 'new java.util.List<Int>'
This commit is contained in:
@@ -1,2 +1,38 @@
|
||||
fun Int?.optint() : Unit
|
||||
val Int?.optval : Unit
|
||||
val Int?.optval : Unit
|
||||
|
||||
fun <T, E> T.foo(x : E, y : A) : T {
|
||||
y.plus(1)
|
||||
y plus 1
|
||||
y + 1.0
|
||||
|
||||
this?.minus<T>(this)
|
||||
|
||||
this
|
||||
}
|
||||
|
||||
class A
|
||||
|
||||
fun A.plus(a : Any) {
|
||||
|
||||
1.foo()
|
||||
true.foo<error>()</error>
|
||||
|
||||
1
|
||||
}
|
||||
|
||||
fun A.plus(a : Int) {
|
||||
1
|
||||
}
|
||||
|
||||
fun <T> T.minus(t : T) : Int = 1
|
||||
|
||||
fun test() {
|
||||
val y = 1.abs
|
||||
}
|
||||
val Int.abs : Int
|
||||
get() = if (this > 0) this else -this;
|
||||
|
||||
val <T> T.foo : T
|
||||
|
||||
fun Int.foo() = this
|
||||
@@ -20,4 +20,6 @@ fun test(l : java.util.List<Int>) {
|
||||
|
||||
Collections.singleton<Int>(1) : Set<Int>?
|
||||
Collections.singleton<Int><error>(1.0)</error>
|
||||
|
||||
<error>new List<Int></error>
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ fun <~T~T, ~E~E> `T`T.foo(x : `E`E, y : `A`A) : `T`T {
|
||||
y `+`plus 1
|
||||
y `+1`+ 1.0
|
||||
|
||||
this?.minus<T>(this)
|
||||
this?.`-`minus<T>(this)
|
||||
|
||||
this
|
||||
}
|
||||
@@ -13,7 +13,7 @@ fun <~T~T, ~E~E> `T`T.foo(x : `E`E, y : `A`A) : `T`T {
|
||||
~+1~fun `A`A.plus(a : Any) {
|
||||
|
||||
1.`foo`foo()
|
||||
true.`!`foo()
|
||||
true.`foo`foo()
|
||||
|
||||
1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user