From a6064ecda6189f887e48a458c15bede7046dfc62 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Fri, 17 Apr 2020 23:06:23 +0700 Subject: [PATCH] [Commonizer] Generate correct TA types for callable descriptors Issue #KMM-217 --- .../descriptors/commonizer/builder/builderUtils.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/builderUtils.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/builderUtils.kt index a908dc2b07f..37b43c2e43c 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/builderUtils.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/builder/builderUtils.kt @@ -122,7 +122,8 @@ internal fun CirSimpleType.buildType( // TODO: commonize annotations, KT-34234 val typeAnnotations = if (!targetComponents.isCommon) annotations.buildDescriptors(targetComponents) else Annotations.EMPTY - val rawType = simpleType( + + val simpleType = simpleType( annotations = typeAnnotations, constructor = classifier.typeConstructor, arguments = arguments.map { it.buildArgument(targetComponents, typeParameterResolver) }, @@ -130,7 +131,15 @@ internal fun CirSimpleType.buildType( kotlinTypeRefiner = null ) - return if (isDefinitelyNotNullType) rawType.makeSimpleTypeDefinitelyNotNullOrNotNull() else rawType + val computedType = if (classifier is TypeAliasDescriptor) + classifier.underlyingType.withAbbreviation(simpleType) + else + simpleType + + return if (isDefinitelyNotNullType) + computedType.makeSimpleTypeDefinitelyNotNullOrNotNull() + else + computedType } internal fun findClassOrTypeAlias(