[K/N] Header klibs: Keep private properties in value classes

^KT-61767 Fixed
This commit is contained in:
Johan Bay
2023-09-07 12:43:22 +02:00
committed by Space Cloud
parent 64fb36deef
commit a1c2ded8a3
4 changed files with 14 additions and 11 deletions
@@ -163,15 +163,10 @@ class DescriptorSerializer private constructor(
classDescriptor.inlineClassRepresentation?.let { inlineClassRepresentation ->
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(inlineClassRepresentation.underlyingPropertyName)
// The underlying property might be missing from `callableMembers` if we are producing a header klib and
// the inline class is a part of the public API but the underlying property is not.
val property = callableMembers.singleOrNull { candidate ->
candidate is PropertyDescriptor
&& candidate.extensionReceiverParameter == null
&& candidate.name == inlineClassRepresentation.underlyingPropertyName
} ?: return@let
if (property.visibility.isPublicAPI) {
val property = callableMembers.single {
it is PropertyDescriptor && it.extensionReceiverParameter == null && it.name == inlineClassRepresentation.underlyingPropertyName
}
if (!property.visibility.isPublicAPI) {
if (useTypeTable()) {
builder.inlineClassUnderlyingTypeId = typeId(inlineClassRepresentation.underlyingType)
} else {