Skip to content

[Distributed] Only parse distributed when experimental mode enabled #38889

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 2 commits into from
Aug 17, 2021

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Aug 16, 2021

We didn't completely implement the guarding of distributed in parsing, so it might have continued anyway, and fail when module types were needed.

This now fails at compilation right away when distributed keyword is encountered but the experimental mode is not enabled.

Resolves rdar://81909966

@ktoso ktoso changed the title [Distributed] Only parse distributed when experimentla mode enabled [Distributed] Only parse distributed when experimental mode enabled Aug 16, 2021
@ktoso
Copy link
Contributor Author

ktoso commented Aug 16, 2021

@swift-ci please smoke test

Comment on lines +1614 to +1621
// If this attribute is only permitted when distributed is enabled, reject it.
if (DeclAttribute::isDistributedOnly(DK) &&
!shouldParseExperimentalDistributed()) {
diagnose(Loc, diag::attr_requires_distributed, AttrName,
DeclAttribute::isDeclModifier(DK));
DiscardAttribute = true;
}

Copy link
Member

Choose a reason for hiding this comment

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

I feel like this is the only thing that's actually needed to solve the issue. Everything else is just for availability things.

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'll remove the availability support from this PR, thanks

@@ -24,6 +24,8 @@ constexpr static const StringLiteral STDLIB_NAME = "Swift";
constexpr static const StringLiteral SWIFT_ONONE_SUPPORT = "SwiftOnoneSupport";
/// The name of the Concurrency module, which supports that extension.
constexpr static const StringLiteral SWIFT_CONCURRENCY_NAME = "_Concurrency";
/// The name of the Distributed module, which supports that extension.
constexpr static const StringLiteral SWIFT_DISTRIBUTED_NAME = "_Distributed";
Copy link
Member

Choose a reason for hiding this comment

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

I thought the module is called Distributed right now, with no underscore. The underscore is for implicitly-imported modules I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The import is _Distributed, same as _Concurrency was and it did have to be imported explicitly for a while.

@ktoso ktoso force-pushed the wip-distributed-only-exp branch from 52b0163 to 5617856 Compare August 16, 2021 22:30
@ktoso
Copy link
Contributor Author

ktoso commented Aug 16, 2021

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit 1e5dc45 into swiftlang:main Aug 17, 2021
@ktoso ktoso deleted the wip-distributed-only-exp branch August 17, 2021 11:17
@ktoso ktoso added the distributed Feature → concurrency: distributed actor label Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants