Fix producing framework with extensions to Any

This commit is contained in:
Svyatoslav Scherbina
2018-02-12 13:59:26 +03:00
committed by SvyatoslavScherbina
parent 9789420ed3
commit b98afb6c88
2 changed files with 6 additions and 5 deletions
@@ -41,7 +41,11 @@ internal class ObjCExportHeaderGenerator(val context: Context) {
override fun getCategoryMembersFor(descriptor: ClassDescriptor) =
extensions[descriptor].orEmpty()
override val specialMappedTypes get() = customTypeMappers.keys
override fun isSpecialMapped(descriptor: ClassDescriptor): Boolean {
// TODO: this method duplicates some of the [mapReferenceType] logic.
return descriptor == context.builtIns.any ||
descriptor.getAllSuperClassifiers().any { it in customTypeMappers }
}
}
val namer = ObjCExportNamer(context, mapper)
@@ -34,15 +34,12 @@ import org.jetbrains.kotlin.types.typeUtil.isUnit
internal interface ObjCExportMapper {
fun getCategoryMembersFor(descriptor: ClassDescriptor): List<CallableMemberDescriptor>
val maxFunctionTypeParameterCount get() = 22
val specialMappedTypes: Set<ClassDescriptor>
fun isSpecialMapped(descriptor: ClassDescriptor): Boolean
}
private fun ObjCExportMapper.isRepresentedAsObjCInterface(descriptor: ClassDescriptor): Boolean =
!descriptor.isInterface && !isSpecialMapped(descriptor)
private fun ObjCExportMapper.isSpecialMapped(descriptor: ClassDescriptor): Boolean =
descriptor.getAllSuperClassifiers().any { it in specialMappedTypes }
internal fun ObjCExportMapper.getClassIfCategory(descriptor: CallableMemberDescriptor): ClassDescriptor? {
if (descriptor.dispatchReceiverParameter != null) return null