Skip to content

[AccessRequests] Allow Init accessor to be internal #72857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 20, 2024

Conversation

li3zhen1
Copy link
Contributor

@li3zhen1 li3zhen1 commented Apr 4, 2024

  • Disallow init accessors in extensions.
  • Allow init accessor to be internal.

Resolves #71578

@li3zhen1 li3zhen1 requested a review from tshortli as a code owner April 16, 2024 20:21
@li3zhen1 li3zhen1 force-pushed the fix-init-accessor-71578 branch from 5aef6c0 to da5dd94 Compare May 3, 2024 02:53
@li3zhen1 li3zhen1 changed the title [SILGen] Prevent init accessors from being accessed outside of its le… [AccessRequests] Allow Init accessor to be internal May 3, 2024
@xedin
Copy link
Contributor

xedin commented Jun 14, 2024

@swift-ci please test

@xedin
Copy link
Contributor

xedin commented Jun 17, 2024

@li3zhen1 Sorry it took so long! Would you mind fixing the test-case that is failing or should I?

@xedin
Copy link
Contributor

xedin commented Jun 18, 2024

@swift-ci please test

// These are only called from designated initializers.
return AccessLevel::Private;
// These are only called from within the same module.
return std::min(storage->getFormalAccess(), AccessLevel::Internal);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

The init accessor should be accessible within the module but it's currently impossible to use it across different files in the module.

@xedin
Copy link
Contributor

xedin commented Jun 19, 2024

@swift-ci please test

@xedin xedin merged commit 76d5dd4 into swiftlang:main Jun 20, 2024
5 checks passed
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.

Init Accessors not found by linker when used in another file
3 participants