Skip to content

Commit

Permalink
Fix support for mutable global properties with non-exposed setter.
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipDolnik committed Feb 9, 2024
1 parent 53e6f0a commit 1b4d6ce
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion SKIE/acceptance-tests
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ sealed interface OirCallableDeclaration : OirElement {

val deprecationLevel: DeprecationLevel

// TODO This is likely not needed
val visibility: OirVisibility
get() = originalSirCallableDeclaration.visibility.toOirVisibility()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class CreateKirMembersPhase(
createProperty(descriptor, kirClass, origin)
}

private fun getOrCreateOverridenProperty(descriptor: PropertyDescriptor, origin: Origin): KirProperty {
private fun getOrCreateOverriddenProperty(descriptor: PropertyDescriptor, origin: Origin): KirProperty {
val classDescriptor = descriptorProvider.getReceiverClassDescriptorOrNull(descriptor)
?: error("Unsupported property $descriptor")

Expand All @@ -203,13 +203,13 @@ class CreateKirMembersPhase(
origin = origin,
scope = kirClass.callableDeclarationScope,
type = kirTypeTranslator.mapReturnType(originalDescriptor.getter!!, getterBridge.returnBridge),
isVar = descriptor.isVar,
isVar = descriptor.setter?.let { descriptorProvider.isExposable(it) } ?: false,
deprecationLevel = descriptor.kirDeprecationLevel,
isRefinedInSwift = baseDescriptor.isRefinedInSwift,
)

getDirectParents(descriptor)
.map { getOrCreateOverridenProperty(it, origin) }
.map { getOrCreateOverriddenProperty(it, origin) }
.let { property.addOverrides(it) }

return property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ class CreateSirMembersPhase(
throws = false,
)
}
property.descriptor.setter?.let {

if (property.isVar) {
SirSetter(
throws = false,
)
Expand Down

0 comments on commit 1b4d6ce

Please sign in to comment.