type inference with functional literal params changed

if there are function literals without declared parameter types,
try adding constraint with current substituted result first (known type parameters),
if there is error, try adding constraint with 'dont_care' substitution
This commit is contained in:
Svetlana Isakova
2012-07-20 16:27:47 +04:00
parent a54b162e36
commit a4bb47a73f
4 changed files with 47 additions and 5 deletions
@@ -0,0 +1,12 @@
package n
//+JDK
import java.util.*
fun expected<T>(t: T, <!UNUSED_PARAMETER!>f<!>: () -> T) : T = t
fun test(arrayList: ArrayList<Int>, list: List<Int>) {
val <!UNUSED_VARIABLE!>t<!> = expected(arrayList, { list.reverse() })
}
fun <T> List<T>.reverse() : List<T> = this