tests for type inference tasks added
#KT-742 fixed #KT-832 fixed #KT-943 fixed
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user