Duplicate test for NI and OI to avoid mismatch of diagnostics

There is a problem with different order of diagnostics for NI and OI,
 so, in order to fix this test, it was duplicated
This commit is contained in:
Mikhail Zarechenskiy
2019-05-27 11:32:21 +03:00
parent 95710f4087
commit 8bef345f0f
4 changed files with 31 additions and 2 deletions
@@ -1,7 +1,7 @@
// !LANGUAGE: -NewInference
// SKIP_TXT
// WITH_RUNTIME
// COMMON_COROUTINES_TEST
// !WITH_NEW_INFERENCE
import COROUTINES_PACKAGE.*
@@ -15,6 +15,6 @@ suspend fun fib(n: Long) =
async {
when {
n < 2 -> n
else -> <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>fib(n - 1)<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>await<!>() <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> fib(n - 2).<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>await<!>()
else -> <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>fib<!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>n<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>-<!> 1)<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>await<!>() <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> fib(n - 2).<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>await<!>()
}
}
@@ -0,0 +1,19 @@
// !LANGUAGE: +NewInference
// SKIP_TXT
// WITH_RUNTIME
import kotlin.coroutines.*
interface Job : CoroutineContext.Element {}
interface Deferred<out T> : Job {
suspend fun await(): T
}
fun <T> async(<!UNUSED_PARAMETER!>block<!>: suspend () -> T): Deferred<T> = TODO()
suspend fun fib(n: Long) =
async {
when {
n < 2 -> n
else -> <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>fib<!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>n<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>-<!> 1)<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>await<!>() <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> fib(n - 2).<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>await<!>()
}
}
@@ -1553,6 +1553,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.kt", "kotlin.coroutines");
}
@TestMetadata("kt18292_ni.kt")
public void testKt18292_ni() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292_ni.kt");
}
@TestMetadata("kt28658.kt")
public void testKt28658() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.kt");
@@ -1553,6 +1553,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.kt", "kotlin.coroutines");
}
@TestMetadata("kt18292_ni.kt")
public void testKt18292_ni() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292_ni.kt");
}
@TestMetadata("kt28658.kt")
public void testKt28658() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.kt");