Skip to content

[CoroutineAccessors] Initial framing. #76526

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 14 commits into from
Sep 30, 2024

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Sep 17, 2024

Initial steps towards read and modify. Add a new feature flag. Behind it, allow parsing the keywords. Add mangling for these symbols. For now, they are emitted just like _read and _modify.

And replaced direct comparisons with calls to predicates.  In
preparation for introducing parallel non-underscored accessors.
To the routine that parses the introducer for an accessor whether it is
would be first accessor, pass whether it would be the first accessor;
from it, return whether the accessor is from an unavailable feature.
These both enable expected behavior when an experimental feature is
disabled: the former enables maintaining source compatibility with code
that uses the introducer name as a function name which is called with a
trailing closure as the first expression in an implicit getter.  The
latter enables suppressing duplicative diagnostics.
It was once used for materializeForSet.
Enable customizing the behavior of macro expansions of for accessors
which are experimental coroutines.
Don't bother saving the previous ExcludeAttrList's size and restoring it
after execution when that list isn't modified.
And move a couple of StorageImplInfo member functions into it. In
preparation for making them use an ASTContext, to avoid importing that
header into StorageImpl.h, a lightweight header.
@nate-chandler nate-chandler force-pushed the general-coro/20240906/1 branch from 02c06eb to 30f2c3c Compare September 26, 2024 04:13
In preparation to introduce more calls.
Make use of swift::getAccessorNameForDiagnostic instead of having a
parallel list of accessor names in DiagnosticsSema.def.
@nate-chandler nate-chandler force-pushed the general-coro/20240906/1 branch from 30f2c3c to 3c1361c Compare September 26, 2024 15:51
Refer to the correct problematic accessor or accessors.
The name is a placeholder for the mutating single-yield coroutine
accessor.
The name is a placeholder for the mutating single-yield coroutine
accessor.
@nate-chandler nate-chandler force-pushed the general-coro/20240906/1 branch from 3c1361c to 091368b Compare September 27, 2024 01:11
@nate-chandler
Copy link
Contributor Author

swiftlang/swift-syntax#2855

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

swiftlang/swift-syntax#2855

@swift-ci please test source compatibility

@nate-chandler
Copy link
Contributor Author

swiftlang/swift-syntax#2855

@swift-ci please test linux platform

@@ -7861,7 +7861,9 @@ static bool isAllowedWhenParsingLimitedSyntax(AccessorKind kind, bool forSIL) {
case AccessorKind::WillSet:
case AccessorKind::DidSet:
case AccessorKind::Read:
case AccessorKind::Read2:
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to have more descriptive names here than Read2? For example, rename the exiting Read to UnderscoreRead and then use Read for Read2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think Read2 and Modify2 are fine placeholders for now until the final names are decided on.

@nate-chandler nate-chandler merged commit ba8f8ea into swiftlang:main Sep 30, 2024
7 checks passed
@nate-chandler nate-chandler deleted the general-coro/20240906/1 branch September 30, 2024 14:04
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