mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-09 03:17:54 +00:00
docs(test): correct the per-language cause of the attribution limit (#2693)
The comment on the pinned attribution tests claimed "a closure literal is a BLOCK scope in these languages". That is true for Kotlin (lambda_literal @scope.block, #1757) and Ruby (do_block/block @scope.block) and FALSE for PHP: anonymous_function and arrow_function are already @scope.function (php/query.ts:61-62). Dart is a third case again — it has no scope over a closure literal at all. So the four languages fail at three different points, not one: Kotlin, Ruby fail the `child.kind === 'Function'` gate PHP passes that gate; its closure scope owns no callable def, because the binding's def belongs to the enclosing scope Dart has no child scope for the walk to consider Worth correcting carefully rather than tidying: a follow-up plan re-stated this comment instead of re-deriving it, and inherited the misdiagnosis — it proposed "relax the kind gate" as required for all four, which is a no-op for PHP and unreachable for Dart. A review caught it. The comment now states each language's actual blocker and says why the distinction matters. Comment-only; the three pinned tests are unchanged and still pass.
This commit is contained in:
parent
15cd66853c
commit
7178fc9ac1
1 changed files with 18 additions and 6 deletions
|
|
@ -485,12 +485,24 @@ describeIfWorkerBuilt('a closure binding is a call TARGET, not yet a call SOURCE
|
|||
//
|
||||
// Cause: `pickCallerCallableDef` (graph-bridge/ids.ts) finds the caller by
|
||||
// walking CHILD scopes whose range contains the call site, gated on
|
||||
// `child.kind === 'Function'`. A closure literal is a BLOCK scope in these
|
||||
// languages (Kotlin deliberately, #1757 smart casts), and the binding's def is
|
||||
// owned by the enclosing scope rather than by the closure's scope — so neither
|
||||
// half of the link exists. Fixing it means decoupling "callable boundary" from
|
||||
// scope `kind` AND associating the closure scope with its binding; that is the
|
||||
// orthogonal-scope-attribute work, not a query change.
|
||||
// `child.kind === 'Function'`, and then requires that child to OWN a
|
||||
// callable def. The languages here fail at different points, which is worth
|
||||
// stating precisely because an earlier version of this comment claimed one
|
||||
// shared cause and that error propagated into a follow-up plan:
|
||||
//
|
||||
// - Kotlin (`lambda_literal` @scope.block, deliberately — #1757 smart
|
||||
// casts) and Ruby (`do_block`/`block` @scope.block) fail the KIND gate.
|
||||
// - PHP does NOT: `anonymous_function`/`arrow_function` are already
|
||||
// @scope.function (php/query.ts:61-62). It fails only the second half —
|
||||
// the `$handler` def is owned by the enclosing scope, so the closure's
|
||||
// own scope owns no callable def.
|
||||
// - Dart has no scope over a closure literal at all, so there is no child
|
||||
// scope for the walk to consider.
|
||||
//
|
||||
// So a fix needs per-language work, not one switch: a callable-boundary
|
||||
// signal independent of scope `kind` (Kotlin/Ruby), an association from a
|
||||
// closure scope to its binding's def (PHP), and a scope that does not exist
|
||||
// yet (Dart). See #2699.
|
||||
//
|
||||
// TS/JS free bindings are the exception: their arrow has a `@scope.function`
|
||||
// with a matching range, so the closure IS the anchor there. These tests exist
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue