Added tests for simple approximation (of Captured(out/in Int))

This commit is contained in:
Svetlana Isakova
2014-12-17 16:31:06 +03:00
parent 9d09a4d1b4
commit 74a08c9747
5 changed files with 36 additions and 0 deletions
@@ -0,0 +1,8 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !CHECK_TYPE
fun <T> foo(a: Array<T>): T = null!!
fun test(a: Array<in Int>) {
foo(a) checkType { it : _<Any?> }
}
@@ -0,0 +1,4 @@
package
internal fun </*0*/ T> foo(/*0*/ a: kotlin.Array<T>): T
internal fun test(/*0*/ a: kotlin.Array<in kotlin.Int>): kotlin.Unit
@@ -0,0 +1,8 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !CHECK_TYPE
fun <T> foo(a: Array<T>): T = null!!
fun test(a: Array<out Int>) {
foo(a) checkType { it : _<Int> }
}
@@ -0,0 +1,4 @@
package
internal fun </*0*/ T> foo(/*0*/ a: kotlin.Array<T>): T
internal fun test(/*0*/ a: kotlin.Array<out kotlin.Int>): kotlin.Unit
@@ -5195,6 +5195,18 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes/kt2872.kt");
doTest(fileName);
}
@TestMetadata("overApproximationForInCaptured.kt")
public void testOverApproximationForInCaptured() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes/overApproximationForInCaptured.kt");
doTest(fileName);
}
@TestMetadata("overApproximationForOutCaptured.kt")
public void testOverApproximationForOutCaptured() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes/overApproximationForOutCaptured.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/tests/inference/constraints")