@@ -14,13 +14,11 @@ import org.jetbrains.kotlin.backend.konan.ir.*
14
14
import org.jetbrains.kotlin.backend.konan.llvm.IntrinsicType
15
15
import org.jetbrains.kotlin.backend.konan.llvm.tryGetIntrinsicType
16
16
import org.jetbrains.kotlin.backend.konan.serialization.isFromCInteropLibrary
17
- import org.jetbrains.kotlin.descriptors.ClassDescriptor
18
17
import org.jetbrains.kotlin.descriptors.ClassKind
19
18
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
20
19
import org.jetbrains.kotlin.descriptors.Modality
21
20
import org.jetbrains.kotlin.ir.IrElement
22
21
import org.jetbrains.kotlin.ir.IrStatement
23
- import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
24
22
import org.jetbrains.kotlin.ir.builders.*
25
23
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
26
24
import org.jetbrains.kotlin.ir.declarations.*
@@ -338,7 +336,6 @@ private class InteropLoweringPart1(val generationState: NativeGenerationState) :
338
336
}
339
337
}
340
338
341
- @OptIn(ObsoleteDescriptorBasedAPI ::class )
342
339
private class InteropTransformerPart1 (
343
340
generationState : NativeGenerationState ,
344
341
irFile : IrFile ? ,
@@ -471,9 +468,9 @@ private class InteropTransformerPart1(
471
468
}
472
469
473
470
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 ]
477
474
it.name == otherParameter.name && it.type == otherParameter.type
478
475
}
479
476
}
@@ -483,13 +480,14 @@ private class InteropTransformerPart1(
483
480
require(function.valueParameters.all { it.type.isObjCObjectType() }) { renderCompilerError(function) }
484
481
require(function.returnType.isUnit()) { renderCompilerError(function) }
485
482
486
- return generateFunctionImp(inferObjCSelector(function.descriptor ), function)
483
+ return generateFunctionImp(inferObjCSelector(function), function)
487
484
}
488
485
489
486
private fun generateOutletSetterImp (property : IrProperty ): IrSimpleFunction {
490
487
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) }
493
491
494
492
val name = property.name.asString()
495
493
val selector = " set${name.replaceFirstChar(Char ::uppercaseChar)} :"
@@ -616,11 +614,11 @@ private class InteropTransformerPart1(
616
614
require(irClass.companionObject()?.getSuperClassNotAny()?.hasFields() != true ) { renderCompilerError(irClass) }
617
615
618
616
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) }
622
620
623
- if (descriptor .kind == ClassKind .CLASS ) {
621
+ if (superClass .kind == ClassKind .CLASS ) {
624
622
hasObjCClassSupertype = true
625
623
}
626
624
}
@@ -685,16 +683,11 @@ private class InteropTransformerPart1(
685
683
)
686
684
687
685
val superConstructor = delegatingCallConstructingClass
688
- .constructors.single { it.valueParameters.size == 0 }.symbol
686
+ .constructors.single { it.valueParameters.size == 0 }
689
687
690
688
return builder.irBlock(expression) {
691
689
// 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)
698
691
+ irCall(symbols.interopObjCObjectSuperInitCheck).apply {
699
692
extensionReceiver = irGet(constructedClass.thisReceiver!! )
700
693
putValueArgument(0 , initCall)
@@ -902,7 +895,6 @@ private class InteropLoweringPart2(val generationState: NativeGenerationState) :
902
895
}
903
896
}
904
897
905
- @OptIn(ObsoleteDescriptorBasedAPI ::class )
906
898
private class InteropTransformerPart2 (
907
899
generationState : NativeGenerationState ,
908
900
irFile : IrFile ? ,
@@ -1106,11 +1098,11 @@ private class InteropTransformerPart2(
1106
1098
val signatureTypes = target.allParameters.map { it.type } + target.returnType
1107
1099
1108
1100
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]
1111
1103
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) }
1114
1106
}
1115
1107
1116
1108
builder.at(expression)
0 commit comments