Fix typealias usage nullability and annotations lost in deserialization

Issue #KT-40824 Fixed
This commit is contained in:
Sergey Igushkin
2020-08-05 20:40:28 +04:00
parent 4063aba677
commit f6356199d3
4 changed files with 53 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(expandedType.isNullable() || proto.nullable)
.replaceAnnotations(Annotations.create(annotations + expandedType.annotations))
}
Flags.SUSPEND_TYPE.get(proto.flags) ->
createSuspendFunctionType(annotations, constructor, arguments, proto.nullable)
else ->