Skip to content

[SwiftParser] Add the send call expression (experimental SendCalls) - #3498

Draft
ktoso wants to merge 3 commits into
mainfrom
wip-send-expr-on-main
Draft

ktoso wants to merge 3 commits into
mainfrom
wip-send-expr-on-main

Conversation

@ktoso

@ktoso ktoso commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

This pairs with the experimental work on send (that's being pitched here https://forums.swift.org/t/pitch-2-send-and-oneway-method-calls/90305).

The related swift change is here: swiftlang/swift#93760

This introduces the send call expression, gated behind the SendCalls experimental feature, e.g.:

send counter.increment()

@ktoso

ktoso commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@ktoso

ktoso commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@ktoso

ktoso commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Cross-repo with swiftlang/swift#93760

@swift-ci please test

Comment thread Sources/SwiftParser/Expressions.swift Resolved
@ktoso

ktoso commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Going to wait with this some more, we may decide a different name so maybe I can avoid some churn

ktoso added 3 commits November 5, 2026 16:38
Add `SendExprSyntax` for `send <call>`, a fire-and-forget alternative to
`await` for calls to actor isolated functions, gated behind the `SendCalls`
experimental feature.

Like the C++ parser, `send` is only parsed as the keyword when it is
followed on the same line by an identifier, `self` or a `$` identifier,
so existing uses of `send` as an identifier (`send(x)`, `send = 1`,
`x.send`, `send { }`) keep parsing as before.
Use the shared contextual-keyword disambiguation instead of a custom
peek rule, matching 'copy'/'consume'/'each'. This also makes 'send' a
keyword before any expression-starting token, e.g. 'send try x.f()'
now parses as a 'SendExprSyntax' of a 'TryExprSyntax' instead of a
"consecutive statements" error; such code was never valid as two
statements anyway.
@ktoso
ktoso force-pushed the wip-send-expr-on-main branch from 1d2b39a to 0363ef4 Compare November 5, 2026 07:48
@ktoso

ktoso commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

case .throws:
return KeywordSpec("throws", isLexerClassified: true)
case .send:
return KeywordSpec("send")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did the experimental feature here get dropped intentionally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry let me make this a draft for now, was building a toolchain using ci for an adopter to try out and dropped it. I'll ping when reviewable !

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.

3 participants