@@ -14,13 +14,11 @@ import org.jetbrains.kotlin.backend.konan.ir.*
1414import org.jetbrains.kotlin.backend.konan.llvm.IntrinsicType
1515import org.jetbrains.kotlin.backend.konan.llvm.tryGetIntrinsicType
1616import org.jetbrains.kotlin.backend.konan.serialization.isFromCInteropLibrary
17- import org.jetbrains.kotlin.descriptors.ClassDescriptor
1817import org.jetbrains.kotlin.descriptors.ClassKind
1918import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
2019import org.jetbrains.kotlin.descriptors.Modality
2120import org.jetbrains.kotlin.ir.IrElement
2221import org.jetbrains.kotlin.ir.IrStatement
23- import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
2422import org.jetbrains.kotlin.ir.builders.*
2523import org.jetbrains.kotlin.ir.builders.declarations.buildFun
2624import org.jetbrains.kotlin.ir.declarations.*
@@ -338,7 +336,6 @@ private class InteropLoweringPart1(val generationState: NativeGenerationState) :
338336 }
339337}
340338
341- @OptIn(ObsoleteDescriptorBasedAPI ::class )
342339private class InteropTransformerPart1 (
343340 generationState : NativeGenerationState ,
344341 irFile : IrFile ? ,
@@ -471,9 +468,9 @@ private class InteropTransformerPart1(
471468 }
472469
473470 private fun IrConstructor.overridesConstructor (other : IrConstructor ): Boolean {
474- return this .descriptor. valueParameters.size == other.descriptor .valueParameters.size &&
475- this .descriptor. valueParameters.all {
476- val otherParameter = other.descriptor. valueParameters[it.index ]
471+ return this .valueParameters.size == other.valueParameters.size &&
472+ this .valueParameters.all {
473+ val otherParameter = other.valueParameters[it.indexInOldValueParameters ]
477474 it.name == otherParameter.name && it.type == otherParameter.type
478475 }
479476 }
@@ -483,13 +480,14 @@ private class InteropTransformerPart1(
483480 require(function.valueParameters.all { it.type.isObjCObjectType() }) { renderCompilerError(function) }
484481 require(function.returnType.isUnit()) { renderCompilerError(function) }
485482
486- return generateFunctionImp(inferObjCSelector(function.descriptor ), function)
483+ return generateFunctionImp(inferObjCSelector(function), function)
487484 }
488485
489486 private fun generateOutletSetterImp (property : IrProperty ): IrSimpleFunction {
490487 require(property.isVar) { renderCompilerError(property) }
491- require(property.getter?.extensionReceiverParameter == null ) { renderCompilerError(property) }
492- require(property.descriptor.type.isObjCObjectType()) { renderCompilerError(property) }
488+ val getter = property.getter!!
489+ require(getter.extensionReceiverParameter == null ) { renderCompilerError(property) }
490+ require(getter.returnType.isObjCObjectType()) { renderCompilerError(property) }
493491
494492 val name = property.name.asString()
495493 val selector = " set${name.replaceFirstChar(Char ::uppercaseChar)} :"
@@ -616,11 +614,11 @@ private class InteropTransformerPart1(
616614 require(irClass.companionObject()?.getSuperClassNotAny()?.hasFields() != true ) { renderCompilerError(irClass) }
617615
618616 var hasObjCClassSupertype = false
619- irClass.descriptor.defaultType. constructor .supertypes .forEach {
620- val descriptor = it.constructor .declarationDescriptor as ClassDescriptor
621- require(descriptor .isObjCClass()) { renderCompilerError(irClass) }
617+ irClass.superTypes .forEach {
618+ val superClass = it.classOrNull?.owner
619+ require(superClass != null && superClass .isObjCClass()) { renderCompilerError(irClass) }
622620
623- if (descriptor .kind == ClassKind .CLASS ) {
621+ if (superClass .kind == ClassKind .CLASS ) {
624622 hasObjCClassSupertype = true
625623 }
626624 }
@@ -685,16 +683,11 @@ private class InteropTransformerPart1(
685683 )
686684
687685 val superConstructor = delegatingCallConstructingClass
688- .constructors.single { it.valueParameters.size == 0 }.symbol
686+ .constructors.single { it.valueParameters.size == 0 }
689687
690688 return builder.irBlock(expression) {
691689 // Required for the IR to be valid, will be ignored in codegen:
692- + IrDelegatingConstructorCallImpl .fromSymbolDescriptor(
693- startOffset,
694- endOffset,
695- context.irBuiltIns.unitType,
696- superConstructor
697- )
690+ + irDelegatingConstructorCall(superConstructor)
698691 + irCall(symbols.interopObjCObjectSuperInitCheck).apply {
699692 extensionReceiver = irGet(constructedClass.thisReceiver!! )
700693 putValueArgument(0 , initCall)
@@ -902,7 +895,6 @@ private class InteropLoweringPart2(val generationState: NativeGenerationState) :
902895 }
903896}
904897
905- @OptIn(ObsoleteDescriptorBasedAPI ::class )
906898private class InteropTransformerPart2 (
907899 generationState : NativeGenerationState ,
908900 irFile : IrFile ? ,
@@ -1106,11 +1098,11 @@ private class InteropTransformerPart2(
11061098 val signatureTypes = target.allParameters.map { it.type } + target.returnType
11071099
11081100 expression.symbol.owner.typeParameters.indices.forEach { index ->
1109- val typeArgument = expression.typeArguments[index]!! .toKotlinType()
1110- val signatureType = signatureTypes[index].toKotlinType()
1101+ val typeArgument = expression.typeArguments[index]!!
1102+ val signatureType = signatureTypes[index]
11111103
1112- require(typeArgument.constructor == signatureType.constructor &&
1113- typeArgument.isMarkedNullable == signatureType.isMarkedNullable ) { renderCompilerError(expression) }
1104+ require(typeArgument.erasedUpperBound == signatureType.erasedUpperBound &&
1105+ typeArgument.isNullable() == signatureType.isNullable() ) { renderCompilerError(expression) }
11141106 }
11151107
11161108 builder.at(expression)
0 commit comments