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
@@ -92,8 +92,12 @@ class TypeDeserializer(
val declarationDescriptor = constructor.declarationDescriptor
val simpleType = when {
expandTypeAliases && declarationDescriptor is TypeAliasDescriptor ->
with(KotlinTypeFactory) { declarationDescriptor.computeExpandedType(arguments) }
expandTypeAliases && declarationDescriptor is TypeAliasDescriptor -> {
val expandedType = with(KotlinTypeFactory) { declarationDescriptor.computeExpandedType(arguments) }
expandedType
.makeNullableAsSpecified(proto.nullable)
.replaceAnnotations(Annotations.create(annotations + expandedType.annotations))
}
Flags.SUSPEND_TYPE.get(proto.flags) ->
createSuspendFunctionType(annotations, constructor, arguments, proto.nullable)
else ->