-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronously using a synchronous disposable that returns a Promise #256
Comments
The native implementation in Chrome Canary Version 135.0.7026.0 (Official Build) canary (arm64) does not run either console.log statement. [Edit: Version 135.0.7036.0 runs both log statements.] The TypeScript runtime emit for the second code snippet does log. TypeScript Playground Link The AsyncDisposableStack polyfill in https://github.com/es-shims/DisposableStack does log for the first snippet. The AsyncDisposableStack polyfill at https://github.com/nberlette/dispose does not log for the first snippet. |
My read of the spec is that both should be logged, because of https://tc39.es/proposal-explicit-resource-management/#sec-getdisposemethod So even though CreateDisposableResource when called with an async-dispose hint always creates a DisposableResource Record with an async hint, the DisposeMethod it's given isn't able to observe any promise that might be returned by a Symbol.dispose method. |
Both should be logged. Per https://arai-a.github.io/ecma262-compare/?pr=3000&id=sec-getdisposemethod, the result of invoking the @syg: Sounds like a bug in V8? |
cc @rmahdav |
Confirm there's a bug in V8 with some accidental promise chaining in the async-from-sync adapter. |
Thank you, Peter. A fix has landed for this bug. |
Should a promise returned by a
Symbol.dispose
method be awaited by AsyncDisposableStack#use /await using
?Put another way:
The text was updated successfully, but these errors were encountered: