[klibs] header klibs should keep private interfaces
^KT-62213 Fixed
This commit is contained in:
+4
@@ -7,9 +7,11 @@ package org.jetbrains.kotlin.fir.serialization
|
||||
|
||||
import org.jetbrains.kotlin.builtins.functions.FunctionTypeKind
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isInterface
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic
|
||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
||||
@@ -54,4 +56,6 @@ fun FirMemberDeclaration.isNotExpectOrShouldBeSerialized(actualizedExpectDeclara
|
||||
|
||||
fun FirMemberDeclaration.isNotPrivateOrShouldBeSerialized(produceHeaderKlib: Boolean): Boolean {
|
||||
return !produceHeaderKlib || visibility.isPublicAPI
|
||||
// Always keep private interfaces as they can be part of public type hierarchies.
|
||||
|| (this as? FirClass)?.isInterface == true
|
||||
}
|
||||
|
||||
+2
@@ -1271,6 +1271,8 @@ open class IrFileSerializer(
|
||||
|
||||
private fun skipIfPrivate(declaration: IrDeclaration) =
|
||||
skipPrivateApi && (declaration as? IrDeclarationWithVisibility)?.visibility?.isPublicAPI != true
|
||||
// Always keep private interfaces as they can be part of public type hierarchies.
|
||||
&& (declaration as? IrClass)?.isInterface != true
|
||||
|
||||
open fun memberNeedsSerialization(member: IrDeclaration): Boolean {
|
||||
val parent = member.parent
|
||||
|
||||
+5
-1
@@ -5,7 +5,11 @@ interface I {
|
||||
fun iMethod(): Int
|
||||
}
|
||||
|
||||
open class A : I {
|
||||
private interface K {
|
||||
fun kMethod() = 42
|
||||
}
|
||||
|
||||
open class A : I, K {
|
||||
override val iProperty: Int = 0
|
||||
override fun iMethod(): Int = 10
|
||||
|
||||
|
||||
+5
@@ -7,6 +7,10 @@ fun useI(i: I) {
|
||||
i.iMethod()
|
||||
}
|
||||
|
||||
fun useK(k: A) {
|
||||
k.kMethod()
|
||||
}
|
||||
|
||||
fun useA(a: A) {
|
||||
a.iProperty
|
||||
a.iMethod()
|
||||
@@ -37,6 +41,7 @@ fun useC(b: String) {
|
||||
|
||||
fun runAppAndReturnOk(): String {
|
||||
useI(A())
|
||||
useK(A())
|
||||
useA(A())
|
||||
useB(B())
|
||||
useC("test")
|
||||
|
||||
Reference in New Issue
Block a user