Files
kotlin-fork/compiler/testData/compileKotlinAgainstKotlin/kt21775.kt
T
Mikhail Zarechenskiy 617bed1bf1 Fix nested typealiases expansion and as a result fix serialization
Consider the following situation:
 ```
 class Inv<T>
 typealias A<K> = Inv<K>
 typealias B<V> = Inv<A<K>>

 fun <U> materialize(): B<U> = TODO()
 ```

 Type `B<U>` is expanding to `Inv<Inv<U>>` and for this type `B<U>` and
 `Inv<A<U>>` are abbreviated types, but due to a bug we forgot to make
 substitution for `Inv<A<U>>` and were getting abbreviated type
 `Inv<A<K>>` where `K` is a type parameter from the typealias declaration.

 This bug didn't affect subtyping anyhow but the incorrect type was
 serialized and caused problems during deserialization as there wasn't
 `K` in deserialization context.

 #KT-24964 Fixed
 #KT-20780 Fixed
 #KT-20065 Fixed
 #KT-28236 Fixed
 #KT-21775 Fixed
2019-02-25 00:28:45 +03:00

43 lines
760 B
Kotlin
Vendored

// FILE: lib.kt
package lib
class TestObserver<T> {
fun assertValue(valuePredicate: (T) -> Boolean): Unit = TODO()
}
class Single<T> {
fun test(): TestObserver<T> = TODO()
}
class Employee
class Either<T>
typealias DomainEither<T> = Either<T>
typealias DomainSingle<T> = Single<DomainEither<T>>
fun provideDomainSingle(): DomainSingle<Employee> = TODO()
class CreateEmployeeUseCaseAccessor {
fun testNormalName() {
val testObs = provideDomainSingle().test()
testObs.assertValue { true }
}
}
// FILE: main.kt
import lib.*
class CreateEmployeeUseCaseTest {
fun testNormalName() {
val testObs = provideDomainSingle().test()
testObs.assertValue { true }
}
}
fun box(): String {
return "OK"
}