You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I initially thought this was a bug with TS, but compiling TS via the playground and running it in Chrome works correctly, as does running it in Bun.
Using using within a for... of loop fails to call the Symbol.dispose method. The same problem occurs when using awaiting using using await using using Symbol.asyncDispose:
classDisposable{disposed=false;[Symbol.dispose](){this.disposed=true}}constdisposables=[newDisposable()]for(using_ofdisposables){/* ... */}if(disposables[0]!.disposed){console.log("✅ dispose ok")}else{console.error("💥 failed to dispose")}classAsyncDisposable{disposed=false;[Symbol.asyncDispose](){this.disposed=true}}constasyncDisposables=[newAsyncDisposable()]for(awaitusing_ofasyncDisposables){/* ... */}if(asyncDisposables[0]!.disposed){console.log("✅ async dispose ok")}else{
console.error("💥 failed to async dispose")}
Keywords: using, using using, using await using, awaiting using await using
The text was updated successfully, but these errors were encountered:
lucacasonato
added
bug
Something isn't working correctly
upstream
Changes in upstream are required to solve these issues
swc
related to swc (bundling/transpiling)
labels
Sep 20, 2024
Seems like an SWC transpilation issue. I've put the reproduction code into their playground and the transpiled output matches exactly what we run in Deno. Running the transpiled output on its own inhibits the described error and the dispose hooks aren't called.
Version: Deno 1.46.3
I initially thought this was a bug with TS, but compiling TS via the playground and running it in Chrome works correctly, as does running it in Bun.
Using
using
within afor... of
loop fails to call theSymbol.dispose
method. The same problem occurs when using awaiting using usingawait using
usingSymbol.asyncDispose
:Keywords: using, using using, using await using, awaiting using await using
The text was updated successfully, but these errors were encountered: