Skip to content

Add a string-based initializer for ExperimentalFeatures. #2895

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 1 commit into from
Nov 12, 2024

Conversation

allevato
Copy link
Member

@allevato allevato commented Nov 8, 2024

Tools (like swift-format) can use this to let users enable experimental features in the parser via interfaces like the command line, without having to handle the translation from string to option set themselves.

/// given name, or returns nil if the name is not recognized.
public init?(name: String) {
switch name {
case "referenceBindings":
Copy link
Member

@ahoppen ahoppen Nov 8, 2024

Choose a reason for hiding this comment

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

I think these feature names should match the experimental feature name in the compiler, which means that they will need to be manually specified.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I renamed the existing featureName to documentationDescription to better describe its purpose (and cleaned up a few of those strings), and then reused featureName for the actual name from Features.def.

@allevato allevato force-pushed the experimental-feature-names branch from 355d2ce to 461cfcc Compare November 11, 2024 13:31
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Just one request for a release notes entry, otherwise LGTM.


/// Creates a new value representing the experimental feature with the
/// given name, or returns nil if the name is not recognized.
public init?(name: String) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a release note entry for this new method?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Tools (like swift-format) can use this to let users enable
experimental features in the parser via interfaces like the
command line, without having to handle the translation from
string to option set themselves.
@allevato allevato force-pushed the experimental-feature-names branch from 461cfcc to d141151 Compare November 12, 2024 00:18
@allevato
Copy link
Member Author

@swift-ci please test

@ahoppen ahoppen merged commit df28b99 into swiftlang:main Nov 12, 2024
3 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.

2 participants