Skip to content

Commit 04d86c1

Browse files
authored
Merge branch 'main' into ci/prepublish-bench-gate
2 parents 1d50950 + bb501e1 commit 04d86c1

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/ast-analysis/visitors/ast-store-visitor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ export function createAstStoreVisitor(
269269
// unrelated subtree. The parent call's skipChildren handles the intended case.
270270
if (matched.has(node.id)) return;
271271

272+
// Gate with `hasOwn` because plain-object lookup walks Object.prototype:
273+
// tree-sitter node types like `constructor` (Haskell sum-types: Left,
274+
// Right) would otherwise resolve to `Object.prototype.constructor` (the
275+
// Object() function), which then crashes the worker boundary with
276+
// "function Object() { [native code] } could not be cloned" when the
277+
// resulting astNodes row is structured-cloned back to the main thread.
278+
if (!Object.hasOwn(astTypeMap, node.type)) return;
272279
const kind = astTypeMap[node.type];
273280
if (!kind) return;
274281

tests/benchmarks/regression-guard.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,14 @@ const SKIP_VERSIONS = new Set(['3.8.0']);
9090
* above the natural variance of the small target set. Not reproducible
9191
* locally (~30ms steady-state); will be re-validated on v3.9.7+ data.
9292
*
93-
* - 3.9.6:resolution haskell precision/recall — separate Haskell resolver
94-
* regression introduced in 3.9.6, unrelated to #1036 / PR #1038. Tracked
95-
* in #1039.
93+
* - 3.9.6:resolution haskell precision/recall — Haskell AST visitor walked
94+
* `astTypeMap` with bracket-notation lookup, so node type `constructor`
95+
* (Haskell sum-types: Left, Right) resolved to `Object.prototype.constructor`
96+
* instead of `undefined`. The Object() function landed in the astNodes row
97+
* and crashed the worker boundary with "function Object() could not be
98+
* cloned", skipping every Haskell file with constructors. Fixed by gating
99+
* with `Object.hasOwn` (#1039). Benchmarks captured before the fix landed;
100+
* will reclear in v3.9.7+ data.
96101
*/
97102
const KNOWN_REGRESSIONS = new Set([
98103
'3.9.0:1-file rebuild',

0 commit comments

Comments
 (0)