-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
oven-sh/WebKit
#162Labels
Description
What version of Bun is running?
v1.3.0+
What platform is your computer?
Darwin 25.0.0 arm64 arm
What steps can reproduce the bug?
#!/bin/bash
# Create repro script
cat > bun-asyncdisposablestack-repro.ts << 'EOF'
await using scope = new AsyncDisposableStack()
scope.use({
async [Symbol.asyncDispose]() {
console.log('async dispose')
},
})
scope.use({
[Symbol.dispose]() {
console.log('sync dispose')
},
})
EOF
echo "=== Testing current Bun version ==="
bun --revision
bun ./bun-asyncdisposablestack-repro.ts
echo -e "\n=== Testing Bun v1.3.0 ==="
curl -fsSl https://bun.sh/install | bash -s "bun-v1.3.0"
bun --revision
bun ./bun-asyncdisposablestack-repro.ts
echo -e "\n=== Testing Bun v1.2.23 with polyfill ==="
curl -fsSl https://bun.sh/install | bash -s "bun-v1.2.23"
bun --revision
bun --preload disposablestack/auto ./bun-asyncdisposablestack-repro.ts
echo -e "\n=== Testing Node.js ==="
node --version
node ./bun-asyncdisposablestack-repro.ts
rm bun-asyncdisposablestack-repro.tsWhat is the expected behavior?
sync dispose
async dispose
everywhere
What do you see instead?
async dispose
4 | async [Symbol.asyncDispose]() {
5 | console.log('async dispose')
6 | },
7 | })
8 |
9 | scope.use({
^
TypeError: @@asyncDispose must be callable
at use (1:11)
at bun-asyncdisposablestack-repro.ts:9:7Additional information
Polyfills do not autoapply because stacks are implemented, however AsyncDisposableStack implementation is incomplete and I see no oneliner workarounds for these versions.
Reactions are currently unavailable