diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.173 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.173 index 93aa080ecdc..c714786edc4 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.173 +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.173 @@ -34,9 +34,11 @@ import org.jetbrains.kotlin.asJava.toLightClass import org.jetbrains.kotlin.asJava.toLightElements import org.jetbrains.kotlin.builtins.isBuiltinFunctionalTypeOrSubtype import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter +import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor +import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.load.kotlin.TypeMappingMode import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext @@ -46,6 +48,8 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.TypeApproximator +import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.isError import org.jetbrains.kotlin.types.typeUtil.isInterface import org.jetbrains.uast.* @@ -95,7 +99,7 @@ internal fun KotlinType.toPsiType(source: UElement, element: KtElement, boxed: B else -> { val typeConstructor = this.constructor if (typeConstructor is IntegerValueTypeConstructor) { - typeConstructor.supertypes.first().toPsiType(source, element, boxed) + TypeUtils.getDefaultPrimitiveNumberType(typeConstructor).toPsiType(source, element, boxed) } else { null } @@ -112,7 +116,8 @@ internal fun KotlinType.toPsiType(source: UElement, element: KtElement, boxed: B val signatureWriter = BothSignatureWriter(BothSignatureWriter.Mode.TYPE) val typeMappingMode = if (boxed) TypeMappingMode.GENERIC_ARGUMENT else TypeMappingMode.DEFAULT - typeMapper.mapType(this, signatureWriter, typeMappingMode) + val approximatedType = TypeApproximator().approximateDeclarationType(this, true, element.languageVersionSettings) + typeMapper.mapType(approximatedType, signatureWriter, typeMappingMode) val signature = StringCharacterIterator(signatureWriter.toString()) diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.as32 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.as32 index 93aa080ecdc..c714786edc4 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.as32 +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt.as32 @@ -34,9 +34,11 @@ import org.jetbrains.kotlin.asJava.toLightClass import org.jetbrains.kotlin.asJava.toLightElements import org.jetbrains.kotlin.builtins.isBuiltinFunctionalTypeOrSubtype import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter +import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor +import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.load.kotlin.TypeMappingMode import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext @@ -46,6 +48,8 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.TypeApproximator +import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.isError import org.jetbrains.kotlin.types.typeUtil.isInterface import org.jetbrains.uast.* @@ -95,7 +99,7 @@ internal fun KotlinType.toPsiType(source: UElement, element: KtElement, boxed: B else -> { val typeConstructor = this.constructor if (typeConstructor is IntegerValueTypeConstructor) { - typeConstructor.supertypes.first().toPsiType(source, element, boxed) + TypeUtils.getDefaultPrimitiveNumberType(typeConstructor).toPsiType(source, element, boxed) } else { null } @@ -112,7 +116,8 @@ internal fun KotlinType.toPsiType(source: UElement, element: KtElement, boxed: B val signatureWriter = BothSignatureWriter(BothSignatureWriter.Mode.TYPE) val typeMappingMode = if (boxed) TypeMappingMode.GENERIC_ARGUMENT else TypeMappingMode.DEFAULT - typeMapper.mapType(this, signatureWriter, typeMappingMode) + val approximatedType = TypeApproximator().approximateDeclarationType(this, true, element.languageVersionSettings) + typeMapper.mapType(approximatedType, signatureWriter, typeMappingMode) val signature = StringCharacterIterator(signatureWriter.toString())