Skip to content

Disallow non-leading solo await within F# pipeline#17803

Merged
JLHwung merged 6 commits intobabel:mainfrom
JLHwung:disallow-non-leading-solo-await
Feb 24, 2026
Merged

Disallow non-leading solo await within F# pipeline#17803
JLHwung merged 6 commits intobabel:mainfrom
JLHwung:disallow-non-leading-solo-await

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Feb 16, 2026

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Per proposal spec,

PipelineExpression[In, Yield, Await]:
    LogicalORExpression[?In, ?Yield, ?Await]
    [~Await]PipelineExpression[?In, ?Yield, ?Await] |> LogicalORExpression[?In, ?Yield, ?Await]
    [+Await]PipelineExpression[?In, ?Yield, ?Await] |> [lookahead ∉ { await }] LogicalORExpression[?In, ?Yield, ?Await]
    [+Await]PipelineExpression[?In, ?Yield, ?Await] |> await

The solo await expression await is only allowed when it is the only production within the pipeline body, there is also a specific await lookahead before forming the LogicalORExpression. Previously Babel allowed solo await within the pipeline body even if the await expression might not be the only production. For example, the following cases were accepted by the current Babel parser but forbidden by the proposal spec:

async function test () {
  x |> async () => await;
  x |> (await);
  x |> await || true
}

The new approach only allows forming AwaitExpression when it see await after the pipeline operator.

We also banned binary operator after solo await as the LogicalORExpression can not cover PipelineExpression, users should parenthesize the complete solo-await pipeline if it is used with a binary operator.

@JLHwung JLHwung added PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Pipeline Operator labels Feb 16, 2026
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Feb 16, 2026

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/60933

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 16, 2026

Open in StackBlitz

commit: 584c2f8

@JLHwung JLHwung force-pushed the disallow-non-leading-solo-await branch from eed88c2 to 584c2f8 Compare February 17, 2026 14:24
@JLHwung JLHwung added PR: Spec Compliance (next major) 👓 A type of pull request used for our changelog categories for next major release and removed PR: Spec Compliance 👓 A type of pull request used for our changelog categories labels Feb 24, 2026
@JLHwung JLHwung merged commit 9182b93 into babel:main Feb 24, 2026
99 of 100 checks passed
@JLHwung JLHwung deleted the disallow-non-leading-solo-await branch February 24, 2026 21:35
@nicolo-ribaudo nicolo-ribaudo added the PR: Spec Compliance 👓 A type of pull request used for our changelog categories label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: parser PR: Spec Compliance 👓 A type of pull request used for our changelog categories PR: Spec Compliance (next major) 👓 A type of pull request used for our changelog categories for next major release Spec: Pipeline Operator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants