diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java index 866f3a5d662..800372b54ff 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java @@ -113,6 +113,31 @@ public class KotlinTypeMapper { } }; + private static final TypeMappingConfiguration staticTypeMappingConfiguration = new TypeMappingConfiguration() { + @NotNull + @Override + public KotlinType commonSupertype(@NotNull Collection types) { + return CommonSupertypes.commonSupertype(types); + } + + @Nullable + @Override + public Type getPredefinedTypeForClass(@NotNull ClassDescriptor classDescriptor) { + return null; + } + + @Nullable + @Override + public String getPredefinedInternalNameForClass(@NotNull ClassDescriptor classDescriptor) { + return null; + } + + @Override + public void processErrorType(@NotNull KotlinType kotlinType, @NotNull ClassDescriptor descriptor) { + throw new IllegalStateException(generateErrorMessageForErrorType(kotlinType, descriptor)); + } + }; + public KotlinTypeMapper( @NotNull BindingContext bindingContext, @NotNull ClassBuilderMode classBuilderMode, @@ -446,6 +471,20 @@ public class KotlinTypeMapper { ); } + public static Type mapInlineClassTypeAsDeclaration(@NotNull KotlinType kotlinType) { + return mapInlineClassType(kotlinType, TypeMappingMode.CLASS_DECLARATION); + } + + public static Type mapInlineClassType( + @NotNull KotlinType kotlinType, + @NotNull TypeMappingMode mode + ) { + return TypeSignatureMappingKt.mapType( + kotlinType, AsmTypeFactory.INSTANCE, mode, staticTypeMappingConfiguration, null, + (ktType, asmType, typeMappingMode) -> Unit.INSTANCE + ); + } + @NotNull public Type mapDefaultImpls(@NotNull ClassDescriptor descriptor) { return Type.getObjectType(mapType(descriptor).getInternalName() + JvmAbi.DEFAULT_IMPLS_SUFFIX);