Skip to content

[Concurrency][oneway] Experimental send expression - #93760

Draft
ktoso wants to merge 5 commits into
mainfrom
wip-ktoso-stack-send-02-send-expression
Draft

ktoso wants to merge 5 commits into
mainfrom
wip-ktoso-stack-send-02-send-expression

Conversation

@ktoso

@ktoso ktoso commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Don't review yet, I'm looking into setting up a PR stack so it's more easily reviewable. This will get cleaned up a bunch more still, I'll mark not-draft when ready.

The related changes in Swift Syntax: swiftlang/swift-syntax#3498 also all gated behind experimental feature for now, so we can rename it.

@ktoso
ktoso added this pull request to stack #93761 October 29, 2026 05:36
@ktoso ktoso changed the title wip ktoso stack send 02 send expression [Concurrency] Experimental send expression Oct 29, 2026
@ktoso ktoso changed the title [Concurrency] Experimental send expression [Concurrency][oneway] Experimental send expression Oct 29, 2026
@ktoso

ktoso commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Cross-repo with swiftlang/swift-syntax#3498

@swift-ci please test

@ktoso
ktoso force-pushed the wip-ktoso-stack-send-02-send-expression branch from 4bc38b4 to 9603211 Compare October 30, 2026 03:27
Base automatically changed from wip-ktoso-stack-send-01-sync-operation-task-minimal to main October 30, 2026 04:33
ktoso added 5 commits October 30, 2026 13:33
Add the experimental `SendCalls` feature and the `SendExpr` AST node, and parse `send <call>` in the C++ parser and in ASTGen. `send` is a contextual keyword, recognized only when it is followed on the same line by an identifier, `self` or a `$` identifier; the type checker rejects `send` calls for now.
Type check and lower `send` calls: the callee must be actor isolated, return `Void` and not throw, and the arguments are evaluated at the call site. A synchronous callee is enqueued through the `_enqueueOneway` helpers in `Actor+Send.swift`, an async callee runs in a discarding task which starts on the callee's actor.
…elpers

Instead of silently falling back to the task-based lowering, which changes the semantics of the call, emit `'send' requires newer _Concurrency library`.
Report `SendCalls` as used by a declaration whose printed inlinable body contains a `send`, so that the module interface guards it with `$SendCalls`.
…end` in the caller

Caller-side default arguments like `#isolation` were evaluated in the operation closure, so they saw its isolation rather than the caller's, and an explicit `#isolation` argument crashed the AST verifier with a duplicate macro discriminator once it was moved back to the call site. Evaluate them at the call site like any other argument, and assign macro discriminators before moving the expansions into the closure.
@ktoso
ktoso force-pushed the wip-ktoso-stack-send-02-send-expression branch from 9603211 to 5316d5e Compare October 30, 2026 04:33
@ktoso

ktoso commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

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.

1 participant