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
@@ -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
}
}