@@ -891,7 +891,7 @@ open class KotlinFileExtractor(
891
891
f.realOverrideTarget.let { it != f && (it as ? IrSimpleFunction )?.modality != Modality .ABSTRACT && isKotlinDefinedInterface(it.parentClassOrNull) }
892
892
893
893
private fun makeInterfaceForwarder (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , extractMethodAndParameterTypeAccesses : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) =
894
- forceExtractFunction(f, parentId, extractBody = false , extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses, overriddenAttributes = OverriddenFunctionAttributes (visibility = DescriptorVisibilities .PUBLIC )).also { functionId ->
894
+ forceExtractFunction(f, parentId, extractBody = false , extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses, overriddenAttributes = OverriddenFunctionAttributes (visibility = DescriptorVisibilities .PUBLIC , modality = Modality . OPEN )).also { functionId ->
895
895
tw.writeCompiler_generated(functionId, CompilerGeneratedKinds .INTERFACE_FORWARDER .kind)
896
896
if (extractBody) {
897
897
val realFunctionLocId = tw.getLocation(f)
@@ -1243,6 +1243,13 @@ open class KotlinFileExtractor(
1243
1243
if (f.isSuspend) {
1244
1244
addModifiers(id, " suspend" )
1245
1245
}
1246
+ if (f.symbol !is IrConstructorSymbol ) {
1247
+ when (overriddenAttributes?.modality ? : (f as ? IrSimpleFunction )?.modality) {
1248
+ Modality .ABSTRACT -> addModifiers(id, " abstract" )
1249
+ Modality .FINAL -> addModifiers(id, " final" )
1250
+ else -> Unit
1251
+ }
1252
+ }
1246
1253
1247
1254
linesOfCode?.linesOfCodeInDeclaration(f, id)
1248
1255
@@ -5304,7 +5311,7 @@ open class KotlinFileExtractor(
5304
5311
// we would need to compose generic type substitutions -- for example, if we're implementing
5305
5312
// T UnaryOperator<T>.apply(T t) here, we would need to compose substitutions so we can implement
5306
5313
// the real underlying R Function<T, R>.apply(T t).
5307
- forceExtractFunction(samMember, classId, extractBody = false , extractMethodAndParameterTypeAccesses = true , typeSub, classTypeArgs, overriddenAttributes = OverriddenFunctionAttributes (id = ids.function, sourceLoc = tw.getLocation(e)))
5314
+ forceExtractFunction(samMember, classId, extractBody = false , extractMethodAndParameterTypeAccesses = true , typeSub, classTypeArgs, overriddenAttributes = OverriddenFunctionAttributes (id = ids.function, sourceLoc = tw.getLocation(e), modality = Modality . FINAL ))
5308
5315
5309
5316
addModifiers(ids.function, " override" )
5310
5317
if (st.isSuspendFunctionOrKFunction()) {
@@ -5529,6 +5536,7 @@ open class KotlinFileExtractor(
5529
5536
val typeParameters : List <IrTypeParameter >? = null ,
5530
5537
val isStatic : Boolean? = null ,
5531
5538
val visibility : DescriptorVisibility ? = null ,
5539
+ val modality : Modality ? = null ,
5532
5540
)
5533
5541
5534
5542
private fun peekDeclStackAsDeclarationParent (elementToReportOn : IrElement ): IrDeclarationParent ? {
0 commit comments