mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-29 23:37:41 +00:00
* fix(scope-resolution): record why a receiver walk stopped at an untyped binder; PHP name fallback respects the stop
The shared claim walk already stops at the nearest scope that lists the
receiver name in Scope.lexicalNames, typed or not, and then skips the
namespace and workspace fallbacks. A stopped walk still returned `undefined`,
which callers could not tell apart from an ordinary miss.
- walkers: findUntypedReceiverBinder names the scope that stopped the walk
only because it binds the name without a type fact (no value binding, no
import, and no name claims deciding the name).
- receiver-bound-calls: a bare receiver that falls through every case at such
a binder records `receiver-type-unresolved` with declineDetail
`untyped-binder` and the binder's scope id. Diagnostic only:
summarizeUnresolvedReceivers does not count it.
- php: phpEmitUnresolvedReceiverEdges no longer turns "no type" into a 0.6
unique-method guess when the walk stopped at an untyped binder. PHP publishes
no lexical names today, so no PHP edge moves; the unit test drives the
emitter with a hand-built scope that does.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(dart): closures and local functions own their binders; the receiver walk stops at them (DART-11)
An inline closure or a local function had no scope of its own, and no Dart
Function scope published the names it binds. In
`void f(Address cs, List items) { items.forEach((cs) { cs.save(); }); cs.save(); }`
the closure's `cs.save()` climbed to f's `Address cs` and emitted a second
`f -> Address.save` edge for a call the source never makes. A typed
`(Other cs)` closure parameter reached `Address.save` the same way.
- Every Function scope carries `@scope.lexical-names`: the parameters, locals,
catch, loop and pattern variables it binds (the binder forms of
addDartBinderName). Nested closures and local functions are not descended
into, so their binders do not stop reads in the enclosing body.
- Inline closures and local functions get a Function scope of their own. It
owns no definition, so calls inside it stay attributed to the enclosing
callable.
- Typed parameters of closures (inline or bound to a name) and of local
functions bind inside that scope, so `(Other cs) { cs.save(); }` reaches
`Other.save`.
Scope-capture bench: only the Dart fingerprint moves (29 existing Function
scope matches gain the lexical-names tag; no group added), rebaselined with a
note. Recall note in docs/languages/dart-ingestion-gaps.md.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* bench(scope-capture): re-measure the Dart fingerprint on the merged tree
Main moved the Dart baseline (DART-04 review round 2 grew the synthetic
unit), so the DART-11 fingerprint is re-measured on this branch merged with
main. Running main's and this branch's emitters over the same input: the same
29 fixture matches gain `@scope.lexical-names` as before the merge, and the
synthetic unit's `use()` scope gains `["e"]` (20 matches). No capture group
added; every other language, PHP included, equals main's committed baseline.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* perf(dart): collect lexical names in Pass B's one walk; emit no scope for a closure that binds nothing
Measured against main (alternating arms, 40 reps, parse excluded), the
per-scope binder walk cost about 10% of Dart capture emission on code with no
closures at all.
- Pass B's tree walk now carries the body that owns each node (set at
function and closure bodies, closures, and signatures, whose parameters
belong to the sibling body), so filing a binder under its scope is a map
lookup, not a walk per scope or a climb per binder. The node type is read
once per node and handed to the callback.
- A closure or local function that binds nothing (`setState(() { ... })`) is
transparent to every lookup, so its scope is not emitted, the same filter
the JavaScript and TypeScript block scopes apply.
- `DART_BINDER_NODE_TYPES` gates `visitDartBinderName`, so the binder list
stays one list for the field mask, the inference census and lexical names.
Captures are byte-identical to the previous commit on every Dart fixture,
the bench synthetic unit, a closure-heavy synthetic and the DART-11 pin
fixtures (56 sources). Emission time vs main: fixture corpus 0.98x, a
Flutter-style file 1.01x (+4% groups), a closure-heavy file 1.05x (+13%
groups for the new closure scopes and parameter bindings).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(dart): accessors and comment-separated signatures open their own Function scope; withhold accessor return bindings (DART-10)
A getter / setter body and a function or method whose body is separated
from its signature by a comment opened no Function scope, so their
parameters bound nothing and their locals leaked into the enclosing
Module / Class scope, typing same-named receivers in other functions
(`User get topGetter { final v = User(); ... }` made
`commentedBare() { v.save(); }` a wrong `User.save` edge).
- query.ts: top-level and member getters / setters carry a private
`@dart.accessor` capture; captures.ts routes it through the
function-scope path. The declaration stays a Property; fields never
carry it; a static accessor binds no `this`.
- findFunctionBody walks past `comment` siblings only, so a bodiless
signature followed by a comment never takes the next member's body;
signatureBefore walks back past them for the body binder census and
the field-shadow set, and the census counts a top-level setter's
parameter.
- An accessor publishes no return binding: hoisted to the Module scope it
would type an untyped same-named receiver (`g(dynamic cs)`,
`var cs = items.first`) through the receiver walk; accessors published
nothing before they had a scope.
- dartParameterReboundInBody withholds a parameter annotation the body
binds again (declarator, closure / local-function parameter, catch or
pattern binder; a plain assignment is not a rebinding). Recall cost:
an outer `cs.save()` beside a closure `(cs) => ...` has no edge.
Full-corpus A/B over the 821 lang-resolution directories: only the new
dart-scope-openers fixture differs (4 wrong edges removed, 1 correct
edge re-attributed, 1 correct edge lost by the rule above). Scope-capture
Dart fingerprint rebaselined; receiver-resolution baseline unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(dart): record DART-10 as fixed and DART-11 as a recorded gap
DART-10 row: accessor and comment-separated Function scopes, the
withheld accessor return bindings and the rebound-parameter rule, with
its recall boundary (a closure parameter reusing the outer parameter's
name loses the outer annotation). DART-11 row: an untyped nearest
binding does not stop the receiver type walk, so a `dynamic` parameter
or a local of unknown type climbs to a same-named hoisted return binding;
tracked separately.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(dart): read an outcome's range only on the kinds that carry one (DART-10)
The resolution-outcome union has a kind without a `range`
(`reexport-ambiguous`), so `tsc -p tsconfig.test.json` rejected the
shadow pin's unconditional `outcome.range`. The pin still lists every
outcome in shadow.dart, whatever its kind, and asserts the same two
`receiver-owned-but-unbound` sites.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(dart): a withheld parameter is owned by its scope; accessor names bind on the class; skip doc comments (DART-10 review 1)
Review round 1 on the DART-10 port:
- H1: when the body declares a typed parameter's name again, the
annotation is withheld AND the Function scope now owns the name
(`dartReceiverOwnerCapture` adds it to the `ownsReceivers` mask next to
the shadowed class fields), so the receiver walk stops there as a
recorded `receiver-owned-but-unbound` drop instead of reaching a
same-named binding further out (a function's or method's hoisted
return, an enum field) and emitting `Other.save`.
- H1b: the withholding rule reads a strict binder count
(`dartIsStrictBinder`): pattern field labels and map keys, the
parameters of a function-typed parameter and pattern assignments
declare nothing. The permissive count stays for the field-shadow mask
and the call-result inference.
- H2: `dartBindingScopeFor` hoists an accessor's name to the enclosing
scope, so a bare getter read in a sibling member stops at `this.name`.
- Both comment node kinds (`comment`, `documentation_comment`) are skipped
between a signature and its body, forward and back.
- Fixtures are valid Dart (getter + setter pairs, untyped `var v;`
library variable and field) and the guard uses an adversary that
publishes a binding (`Factory.cs()`); new withheld.dart,
accessor_names.dart and declares_nothing.dart pin each shape.
Full-corpus A/B against origin/main: only dart-scope-openers differs.
Scope-capture Dart fingerprint rebaselined.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(dart): scope the DART-10 row; record both scope-opener recall boundaries
The DART-10 row names the two fixed shapes and the ones it does not cover
(operator and factory-constructor bodies), and states that a withheld
parameter is owned by its scope, so it ends as a recorded drop. The DART-11
row gives the three reasons DART-10 does not widen the climb. The recall
section lists the rebound-parameter cost (including for-in, a closure
bound to a local and a block local) and the field-shadow mask that
accessor bodies and comment-separated constructors now inherit.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(dart): only declarations become lexical names; statements, closures and catch bodies scope their own binders (DART-11 review)
Review round 1 on the DART-11 change, every finding reproduced first.
- Matching constants, field labels and pattern assignments declared names.
Lexical names now come from a declaration-sensitive reader
(`visitDartDeclaredName`): a `variable_pattern` declares; a bare name
declares only in a `var`/`final` pattern declaration or a pattern for-in;
a label or map key never does; a pattern assignment declares nothing. The
field-shadow mask and the inference census keep the over-approximating
`visitDartBinderName`. `case Address:` keeps its switch edges, an `api:`
label leaves the import prefix reachable, `(cs,) = ...` keeps the outer
parameter.
- A closure scope under a getter, setter, operator or field initializer had
no `this`. An emitted closure or local-function scope now carries the
enclosing class's `this`/`super` binding where no emitted enclosing scope
provides `this`; inside a method it reads the method's.
- A comment between a local function's signature and body moved its typed
parameter onto the enclosing scope. The walk skips comment siblings, and
a deferred scope's parameter and receiver bindings are synthesized only
when that scope is emitted (most closures bind nothing, so this also saves
the work).
- Blocks opened no scope, so a block-local, loop or catch variable either
borrowed a parameter's type or stopped reads after its statement. A
nested block, a `for`, a switch case, an if-case and the body a catch
clause guards now get a Block scope when they declare a name (emitted only
then, the filter the JavaScript and TypeScript block scopes apply).
- `_` declares nothing (Dart 3.7 wildcard variables): no lexical name, no
parameter binding.
- A local function's name is a declaration of its scope; a function-typed
parameter (`Other cs(int a)`) declares `cs`, not `a`.
- Tests: pins for every reproduced shape, `declinesAt` filters by
`siteKind`, Dart suites skip without the grammar; docs and the recorder
comment corrected.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* bench(scope-capture): re-measure the Dart fingerprint after the DART-11 review fixes
Running the previous emitter and this one over the same input: only
dart-async-methods/service.dart differs, where each `for` loop's `i` moves
from its method's Function scope to a Block scope of its own (2 groups
added). The synthetic unit is unchanged; every other language equals its
committed baseline.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(dart): DART-10 row and recall boundaries for the stacked scopes
The DART-10 row describes the per-scope withholding rule and the
untyped-binder stop that replace the round-1 ownership mask. The recall
section keeps the two remaining boundaries: a collection `for` element
that redeclares a typed parameter, and the field-shadow mask that accessor
bodies inherit. The DART-11 row's limits are updated: accessor bodies now
have a Function scope, and a typed parameter whose own scope redeclares
its name keeps no annotation. The round-1 "recorded gap" DART-11 row is
dropped in favour of the DART-11 branch's own row.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(bench): gate Dart accessor scopes and parameter redeclaration scaling (#3904)
#3904 (DART-10, stacked on #3903) gives getters and setters a Function
scope of their own and withholds a typed parameter's annotation only when
its own scope redeclares the name. bench/dart-accessor-scopes pins what
both produce and checks how their cost grows, in the format of
bench/ruby-gem-resolution and bench/dart-deferred-imports.
accessors: classes with an untyped field `v`, getters whose local `v`
types `v.save()` (Address.save), setters whose `Other value` types
`value.run()` (Other.run), and a `reader()` that reads the field and gets
nothing. params: functions with K typed parameters, each redeclared by a
closure and then used, so every `a<j>.run()` reaches Address.run. Each
unit's method CALLS must equal the expected multiset; #3903's head misses
the setter edges and gains a wrong reader edge per class.
--check runs a CI profile (about 14 s locally); --full keeps min of 15
after 2 warmups and a fresh process per shape. Budgets are 1.5, except
accessors resolution over classes (2.2), which is already super-linear on
#3903's head. Re-walking the scope body per parameter binding fails the
params per-unit capture gate (1.872 > 1.5).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(bench): dart-accessor-scopes — one class per file, every budget 1.5, a resolution control that fails
accessors_resolve_unit_scaling_ratio kept a 2.2 budget because every
class sat in lib/main.dart, and Dart resolution is super-linear in the
number of classes in one file. That term predates #3904: over 64 -> 1024
classes it measures 1.34 (1.27-1.42) before #3904 and 1.24 (1.16-1.33)
with it, and a profile puts the growth in materializeBindings ->
dartMergeBindings (x14.8 from 256 to 1024 classes) and
findClassBindingInScope / lookupMatchingNameClaim (x9). With one class
per file the same workload is linear: resolution 0.98 (0.87-1.09),
capture 1.00 (0.91-1.08), fresh process per cell, three rounds.
- accessors now puts one class per file; `--shape crowded` (sweeps
only) keeps the one-file form, recorded in `_one_file_note`;
- every budget is 1.5;
- each shape pins input_bytes (linear in every size parameter);
- rebuilding the workspace MRO once per parsed file fails
accessors_resolve_unit_scaling_ratio 1.901 > 1.5 with unchanged
fingerprints; it passed the old 2.2 budget.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
|
||
|---|---|---|
| .. | ||
| baseline.json | ||
| measure.mjs | ||