Skip to content

Conversation

rbuckton
Copy link
Owner

As requested by implementers, this disallows using/await using directly nested within a case or default clause. This also removes some of the logic in HasCallInTailPosition and HasUnterminatedUsingDeclaration that pertain to case and default as HasUnterminatedUsingDeclaration would no longer apply.

Fixes tc39/proposal-explicit-resource-management#215

/cc @syg, @iainireland, @waldemarhorwat

@rbuckton
Copy link
Owner Author

@dminor: do you want to add this to your agenda topic, or should I create a separate one?

@dminor
Copy link

dminor commented Mar 28, 2025

@dminor: do you want to add this to your agenda topic, or should I create a separate one?

I'll add a slide with this PR and a request for consensus for the change.

@dminor
Copy link

dminor commented Mar 28, 2025

@rbuckton Thank you for putting this together.

@syg
Copy link

syg commented Mar 28, 2025

Note that V8 and Chrome have already shipped, but we are still supportive of this change and will change our implementation. I highly doubt people rely on this in the wild.

@phoddie
Copy link

phoddie commented Mar 31, 2025

Moddable has implemented the currently defined behavior in XS. We agree that using case this way is obscure, at best, and are willing to update XS to support this proposed change.

@dminor
Copy link

dminor commented Mar 31, 2025

SpiderMonkey has implemented the current specification, but we haven't shipped it yet. We're also willing to change our implementation.

pull bot pushed a commit to A-SunsetMkt-Forks/v8 that referenced this pull request May 2, 2025
This CL disallows `using` and `await using` in switch cases.
This was a normative change that got consensus in TC39 meetings:
rbuckton/ecma262#14

Bug: 409478039
Change-Id: I077e75d7d0d632c8b34150cfc76e4903984d6091
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6500234
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100037}
targos pushed a commit to targos/node that referenced this pull request May 8, 2025
Original commit message:

    [explicit-resource-management] disallow using in switch cases

    This CL disallows `using` and `await using` in switch cases.
    This was a normative change that got consensus in TC39 meetings:
    rbuckton/ecma262#14

    Bug: 409478039
    Change-Id: I077e75d7d0d632c8b34150cfc76e4903984d6091
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6500234
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#100037}

Refs: v8/v8@044b9b6
nodejs-github-bot pushed a commit to nodejs/node that referenced this pull request May 10, 2025
Original commit message:

    [explicit-resource-management] disallow using in switch cases

    This CL disallows `using` and `await using` in switch cases.
    This was a normative change that got consensus in TC39 meetings:
    rbuckton/ecma262#14

    Bug: 409478039
    Change-Id: I077e75d7d0d632c8b34150cfc76e4903984d6091
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6500234
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#100037}

Refs: v8/v8@044b9b6
PR-URL: #58230
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
targos pushed a commit to nodejs/node that referenced this pull request May 16, 2025
Original commit message:

    [explicit-resource-management] disallow using in switch cases

    This CL disallows `using` and `await using` in switch cases.
    This was a normative change that got consensus in TC39 meetings:
    rbuckton/ecma262#14

    Bug: 409478039
    Change-Id: I077e75d7d0d632c8b34150cfc76e4903984d6091
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6500234
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#100037}

Refs: v8/v8@044b9b6
PR-URL: #58230
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
targos pushed a commit to targos/node that referenced this pull request May 16, 2025
Original commit message:

    [explicit-resource-management] disallow using in switch cases

    This CL disallows `using` and `await using` in switch cases.
    This was a normative change that got consensus in TC39 meetings:
    rbuckton/ecma262#14

    Bug: 409478039
    Change-Id: I077e75d7d0d632c8b34150cfc76e4903984d6091
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6500234
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#100037}

Refs: v8/v8@044b9b6
PR-URL: nodejs#58230
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
nodejs-github-bot pushed a commit to nodejs/node that referenced this pull request May 18, 2025
Original commit message:

    [explicit-resource-management] disallow using in switch cases

    This CL disallows `using` and `await using` in switch cases.
    This was a normative change that got consensus in TC39 meetings:
    rbuckton/ecma262#14

    Bug: 409478039
    Change-Id: I077e75d7d0d632c8b34150cfc76e4903984d6091
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6500234
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#100037}

Refs: v8/v8@044b9b6
PR-URL: #58230
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
PR-URL: #58064
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@rbuckton rbuckton merged commit 8e5d501 into explicit-resource-management Jun 2, 2025
4 of 7 checks passed
@rbuckton rbuckton deleted the disallow-using-in-switch-case branch June 2, 2025 18:33
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.

4 participants