From 08cc904a713f7b6bb4a37a48873857d91fb8c78f Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Tue, 26 Jan 2021 13:20:29 +0300 Subject: [PATCH] [Commonizer] Restore lost nullability for underlying types in TAs --- .../descriptors/commonizer/cir/factory/CirTypeFactory.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt index 2041142cef2..03b09cef95d 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt @@ -57,9 +57,14 @@ object CirTypeFactory { Annotations.EMPTY ) as AbbreviatedType + val expandedType = extractExpandedType(abbreviatedType) + + val cirExpandedType = create(expandedType, useAbbreviation = true) as CirClassOrTypeAliasType + val cirExpandedTypeWithProperNullability = if (source.isMarkedNullable) makeNullable(cirExpandedType) else cirExpandedType + createTypeAliasType( typeAliasId = classifierDescriptor.internedClassId, - underlyingType = create(extractExpandedType(abbreviatedType), useAbbreviation = true) as CirClassOrTypeAliasType, + underlyingType = cirExpandedTypeWithProperNullability, arguments = createArguments(source.arguments, useAbbreviation = true), isMarkedNullable = source.isMarkedNullable )