Fixed test data for new lambda syntax

This commit is contained in:
Stanislav Erokhin
2015-03-18 00:25:06 +03:00
parent 371908a280
commit 43e24f6b0d
54 changed files with 103 additions and 113 deletions
@@ -5,7 +5,7 @@ fun <T> emptyList(): List<T> = throw Exception()
fun foo<T>(f: T.() -> Unit, l: List<T>): T = throw Exception("$f$l")
fun test() {
val q = foo({ Int.() -> }, emptyList()) //type inference no information for parameter error
val q = foo(fun Int.() {}, emptyList()) //type inference no information for parameter error
q: Int
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>({}, <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>())
@@ -8,7 +8,7 @@ private fun <T> test(value: T, extf: String.(value: T)->Unit) {
}
fun main(args: Array<String>) {
test(1, {(value) -> println(value)})
test(1, {value -> println(value)})
}
fun tests() {
@@ -11,7 +11,7 @@ public fun<TItem, TResult> select(<!UNUSED_PARAMETER!>yielder<!>: ()->Iterable<T
fun a() {
val x = 0..200
val z = x where { (i: Int) -> i % 2 == 0 }
val z = x where { i: Int -> i % 2 == 0 }
val yielder = select(x where { it%2==0 }, { it.toString() })
z : () -> Iterable<Int>
@@ -3,7 +3,7 @@
package d
fun test(numbers: Iterable<Int>) {
val s = numbers.map{it.toString()}.fold(""){(it, it2) -> it + it2}
val s = numbers.map{it.toString()}.fold(""){it, it2 -> it + it2}
<!TYPE_MISMATCH!>s<!>: Int
}
@@ -14,7 +14,7 @@ abstract class Buggy {
get() = <!TYPE_MISMATCH!>coll.find{ it > 3 }<!> // does not work here
val yetAnotherThree : Int
get() = <!TYPE_MISMATCH!>coll.find({ (v:Int) -> v > 3 })<!> // neither here
get() = <!TYPE_MISMATCH!>coll.find({ v:Int -> v > 3 })<!> // neither here
val extendedGetter : Int
get() {
@@ -8,7 +8,7 @@ enum class SomeEnum {
// Doesn't work
fun Iterable<Int>.some() {
this.fold(SomeEnum.FIRST, {(res : SomeEnum, value) ->
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
if (res == SomeEnum.FIRST) SomeEnum.FIRST else SomeEnum.SECOND
})
}
@@ -19,7 +19,7 @@ fun tempFun() : SomeEnum {
// Doesn't work
fun Iterable<Int>.someSimpleWithFun() {
this.fold(SomeEnum.FIRST, {(res : SomeEnum, value) ->
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
tempFun()
})
}
@@ -27,14 +27,14 @@ fun Iterable<Int>.someSimpleWithFun() {
// Works
fun Iterable<Int>.someSimple() {
this.fold(SomeEnum.FIRST, {(res : SomeEnum, value) ->
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
SomeEnum.FIRST
})
}
// Works
fun Iterable<Int>.someInt() {
this.fold(0, {(res : Int, value) ->
this.fold(0, {res : Int, value ->
if (res == 0) 1 else 0
})
}
@@ -15,10 +15,10 @@ fun SomeTemplate.query(f: (i: Int) -> Unit) = f
fun SomeTemplate.query1(f: (i: Int) -> Unit) = f
fun test() {
val mapperFunction = {(i: Int)-> }
val mapperFunction = { i: Int -> }
SomeTemplate().query(mapperFunction)
// TYPE_MISMATCH: Required Class<[ERROR: CANT_INFER]>, Found (kotlin.Int) -> Unit
SomeTemplate().query {(i: Int)-> }
SomeTemplate().query1 {(i: Int)-> }
SomeTemplate().query { i: Int -> }
SomeTemplate().query1 { i: Int -> }
}
@@ -3,7 +3,7 @@ package a
fun <T, R, S> foo(block: (T)-> R, <!UNUSED_PARAMETER!>second<!>: (T)-> S) = block
fun main(args: Array<String>) {
val fff = { (x: Int) -> <!UNRESOLVED_REFERENCE!>aaa<!> }
val fff = { x: Int -> <!UNRESOLVED_REFERENCE!>aaa<!> }
foo(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>fff<!>, { x -> x + 1 })
}
@@ -8,9 +8,9 @@ fun <T, R> bar(f: (T) -> R) = f
fun test() {
<!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>foo<!> <!TYPE_MISMATCH!>{ <!UNRESOLVED_REFERENCE!>it<!> }<!>
<!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>foo<!> <!TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!>}<!>
<!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>foo<!> <!TYPE_MISMATCH!>{ (x: Int) -> x}<!>
<!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>foo<!> <!TYPE_MISMATCH!>{ x: Int -> x}<!>
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!> { <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> 1 }
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!> { <!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> 1}
bar { (x: Int) -> x + 1}
bar { x: Int -> x + 1}
}