Add tests for obsolete issues

#KT-32395 Obsolete (fixed in 42a5c488)
 #KT-32388 Obsolete (fixed in f3e4c9cd)
 #KT-32271 Obsolete (fixed in 60a0cf1)
This commit is contained in:
Mikhail Zarechenskiy
2019-07-03 14:27:18 +03:00
parent 675f01ee80
commit 6eefea6715
11 changed files with 169 additions and 0 deletions
@@ -10295,6 +10295,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
runTest("compiler/testData/diagnostics/tests/inference/nothingType/kt32081.kt");
}
@TestMetadata("kt32388.kt")
public void testKt32388() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/kt32388.kt");
}
@TestMetadata("lambdaNothingAndExpectedType.kt")
public void testLambdaNothingAndExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt");
@@ -0,0 +1,13 @@
// !WITH_NEW_INFERENCE
fun <A, B> Either<A, B>.recover(f: (A) -> B): Either<A, B> = when (this) {
is Either.Left -> f(<!DEBUG_INFO_SMARTCAST!>this<!>.a).right()
is Either.Right -> <!NI;DEBUG_INFO_SMARTCAST!>this<!>
}
fun <A> A.right(): Either<Nothing, A> = Either.Right(this)
sealed class Either<out A, out B> {
class Left<out A> constructor(val a: A) : Either<A, Nothing>()
class Right<out B> constructor(val b: B) : Either<Nothing, B>()
}
@@ -0,0 +1,27 @@
package
public fun </*0*/ A, /*1*/ B> Either<A, B>.recover(/*0*/ f: (A) -> B): Either<A, B>
public fun </*0*/ A> A.right(): Either<kotlin.Nothing, A>
public sealed class Either</*0*/ out A, /*1*/ out B> {
private constructor Either</*0*/ out A, /*1*/ out B>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Left</*0*/ out A> : Either<A, kotlin.Nothing> {
public constructor Left</*0*/ out A>(/*0*/ a: A)
public final val a: A
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Right</*0*/ out B> : Either<kotlin.Nothing, B> {
public constructor Right</*0*/ out B>(/*0*/ b: B)
public final val b: B
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
suspend fun <T> threadSafeSuspendCallback(startAsync: (CompletionLambda<T>) -> CancellationLambda): T = TODO()
typealias CompletionLambda<T> = (result: Result<T>) -> Unit
typealias CancellationLambda = () -> Unit
class Scope {
suspend fun <T> performAndWait(block: suspend CoroutineScope.() -> T): T {
return CoroutineWorker().run {
val result = threadSafeSuspendCallback<T> { completion ->
val workItem = WorkItem {
val result = runCatching {
block()
}
completion(result)
}
return@threadSafeSuspendCallback { Unit }
}
result
}
}
class WorkItem(
val block: suspend CoroutineScope.() -> Unit
)
}
class CoroutineWorker
interface CoroutineScope
@@ -0,0 +1,34 @@
package
public suspend fun </*0*/ T> threadSafeSuspendCallback(/*0*/ startAsync: (CompletionLambda<T> /* = (result: kotlin.Result<T>) -> kotlin.Unit */) -> CancellationLambda /* = () -> kotlin.Unit */): T
public interface CoroutineScope {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class CoroutineWorker {
public constructor CoroutineWorker()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Scope {
public constructor Scope()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final suspend fun </*0*/ T> performAndWait(/*0*/ block: suspend CoroutineScope.() -> T): T
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class WorkItem {
public constructor WorkItem(/*0*/ block: suspend CoroutineScope.() -> kotlin.Unit)
public final val block: suspend CoroutineScope.() -> kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public typealias CancellationLambda = () -> kotlin.Unit
public typealias CompletionLambda</*0*/ T> = (result: kotlin.Result<T>) -> kotlin.Unit
@@ -0,0 +1,26 @@
fun test1(ns: String?, vararg nullableStrs: String?) {
nullableStrs.contains("x")
nullableStrs.contains(ns)
"x" in nullableStrs
ns in nullableStrs
}
fun test2(ns: String?, vararg nonNullableStrs: String) {
nonNullableStrs.contains("x")
nonNullableStrs.contains(ns)
"x" in nonNullableStrs
ns in nonNullableStrs
}
fun test3(ns: String?, nullableStrs: Array<out String?>, nonNullableStrs: Array<out String>) {
nullableStrs.contains("x")
nonNullableStrs.contains("x")
nullableStrs.contains(ns)
nonNullableStrs.contains(ns)
"x" in nullableStrs
"x" in nonNullableStrs
ns in nullableStrs
ns in nonNullableStrs
}
@@ -0,0 +1,5 @@
package
public fun test1(/*0*/ ns: kotlin.String?, /*1*/ vararg nullableStrs: kotlin.String? /*kotlin.Array<out kotlin.String?>*/): kotlin.Unit
public fun test2(/*0*/ ns: kotlin.String?, /*1*/ vararg nonNullableStrs: kotlin.String /*kotlin.Array<out kotlin.String>*/): kotlin.Unit
public fun test3(/*0*/ ns: kotlin.String?, /*1*/ nullableStrs: kotlin.Array<out kotlin.String?>, /*2*/ nonNullableStrs: kotlin.Array<out kotlin.String>): kotlin.Unit
@@ -10302,6 +10302,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/kt32081.kt");
}
@TestMetadata("kt32388.kt")
public void testKt32388() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/kt32388.kt");
}
@TestMetadata("lambdaNothingAndExpectedType.kt")
public void testLambdaNothingAndExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt");
@@ -1887,6 +1887,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt");
}
@TestMetadata("kt32271.kt")
public void testKt32271() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32271.kt");
}
@TestMetadata("nestedLambdaInferenceWithListMap.kt")
public void testNestedLambdaInferenceWithListMap() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt");
@@ -2813,6 +2818,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCaptured.kt");
}
@TestMetadata("onlyInputTypesWithVarargs.kt")
public void testOnlyInputTypesWithVarargs() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWithVarargs.kt");
}
@TestMetadata("propagationOfNoInferAnnotation.kt")
public void testPropagationOfNoInferAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt");
@@ -1887,6 +1887,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt");
}
@TestMetadata("kt32271.kt")
public void testKt32271() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32271.kt");
}
@TestMetadata("nestedLambdaInferenceWithListMap.kt")
public void testNestedLambdaInferenceWithListMap() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt");
@@ -2813,6 +2818,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCaptured.kt");
}
@TestMetadata("onlyInputTypesWithVarargs.kt")
public void testOnlyInputTypesWithVarargs() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWithVarargs.kt");
}
@TestMetadata("propagationOfNoInferAnnotation.kt")
public void testPropagationOfNoInferAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt");
@@ -10297,6 +10297,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/inference/nothingType/kt32081.kt");
}
@TestMetadata("kt32388.kt")
public void testKt32388() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/kt32388.kt");
}
@TestMetadata("lambdaNothingAndExpectedType.kt")
public void testLambdaNothingAndExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt");