tests for type inference tasks added

#KT-742 fixed
 #KT-832 fixed
 #KT-943 fixed
This commit is contained in:
Svetlana Isakova
2012-08-01 17:03:32 +04:00
parent 6d9529e826
commit b5229b8b3d
4 changed files with 53 additions and 0 deletions
@@ -0,0 +1,7 @@
package a
class List<T>(val head: T, val tail: List<T>? = null)
fun <T, Q> List<T>.map1(f: (T)-> Q): List<T>? = tail!!.map1(f)
fun <T, Q> List<T>.map2(f: (T)-> Q): List<T>? = <!TYPE_MISMATCH!>tail<!>.sure<T>().<!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>map2<!>(f)
@@ -0,0 +1,9 @@
package a
fun fooT2<T>() : (t : T) -> T {
return {it}
}
fun test() {
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>fooT2<!>()(1) // here 1 should not be marked with an error
}
@@ -0,0 +1,17 @@
package maze
//+JDK
import java.util.Collections.*
import java.util.*
fun foo(lines: List<String>) {
val w = max(lines, comparator {o1, o2 ->
val l1 : Int = o1.length // Types of o1 and o2 are ERROR
val l2 = o2.length
l1 - l2
}).sure()
w : String
}
//standard library
public inline fun <T> comparator(<!UNUSED_PARAMETER!>fn<!>: (T,T) -> Int): Comparator<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -1375,6 +1375,26 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/inference/regressions/kt731.kt");
}
@TestMetadata("kt742.kt")
public void testKt742() throws Exception {
doTest("compiler/testData/diagnostics/tests/inference/regressions/kt742.kt");
}
@TestMetadata("kt832.kt")
public void testKt832() throws Exception {
doTest("compiler/testData/diagnostics/tests/inference/regressions/kt832.kt");
}
@TestMetadata("kt943.kt")
public void testKt943() throws Exception {
doTest("compiler/testData/diagnostics/tests/inference/regressions/kt943.kt");
}
@TestMetadata("kt948.kt")
public void testKt948() throws Exception {
doTest("compiler/testData/diagnostics/tests/inference/regressions/kt948.kt");
}
}
public static Test innerSuite() {