Skip to content

Conversation

@sepy97
Copy link
Contributor

@sepy97 sepy97 commented Dec 15, 2025

Swift compiler allowed accessing a private setter from an @inlinable function. This change detects and diagnose it with a corresponding error.

rdar://81879146

@sepy97
Copy link
Contributor Author

sepy97 commented Dec 15, 2025

@swift-ci please smoke test

if (accessor->getAccessorKind() == AccessorKind::Set &&
accessor->getFormalAccess() == AccessLevel::Private) {
auto *storage = accessor->getStorage();
if (storage->getAttrs().hasAttribute<UsableFromInlineAttr>()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the storage is public? We don't want to check for this attribute directly, instead check it using access scopes like we do for everything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants