Fix typealias usage nullability and annotations lost in deserialization

This fixes a regression introduced by the commit 4b0da0688a which made
deserializer expand typealiases but didn't take nullability and use site
annotations into account.

Issue #KT-40824 Fixed
This commit is contained in:
Sergey Igushkin
2020-08-01 00:26:45 +04:00
parent ec4f04095c
commit 070848a1c1
4 changed files with 47 additions and 2 deletions
@@ -0,0 +1,31 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
// FILE: A.kt
@Target(AnnotationTarget.TYPE)
annotation class Anno(val value: String)
class Foo
typealias MyFoo = Foo
class C<T>(val t: T)
typealias MyC = C<@Anno("OK") MyFoo?>
// FILE: B.kt
fun test(myc: MyC) {}
fun box(): String {
test(C(null))
val mycType = ::test.parameters.single().type
val argumentType = mycType.arguments.single().type!!
if (!argumentType.isMarkedNullable)
return "Fail: argument type should be seen as nullable"
val annotations = argumentType.annotations
if (annotations.toString() != "[@Anno(value=OK)]")
return "Fail: $annotations"
return "OK"
}