Skip to content

for (using of = is incorrectly parsed.Β #61747

Description

@rbuckton

πŸ”Ž Search Terms

for using of explicit resource management

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play/?lib=lib.esnext.d.ts&ts=lib.esnext.d.ts#code/GYewTgBAFArgzgSwHYHMImBAvBJMA2+A3EQJQQBGYApgIYDWRQA

πŸ’» Code

for (using of = null;;) break;

πŸ™ Actual behavior

Reports multiple errors as a result of failed parse, including:

  • Expression expected.
  • ')' expected.

πŸ™‚ Expected behavior

It should parse successfully, much like the following:

for (var of = null;;) break;
for (let of = null;;) break;
for (const of = null;;) break;

Additional information about the issue

This was discussed in the Explicit Resource Management Repo here: tc39/proposal-explicit-resource-management#248

The test262 test for this can be found here: tc39/test262@fc3079a#diff-4ea0f4ef51852a9dec7036a93ec9576c387d2ad22eaf63992e36f81919c75ce3R14

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions