Repository navigation
feat(kernel): port the remaining upstream resolution drift - #587
Conversation
Ports the behaviours upstream added after the pinned 8e854d1: calls on browser host objects (colbymchenry#2907), enclosing-class member calls, Go receiver typing through parameters, func-typed fields and call results (colbymchenry#2543, colbymchenry#2581), library-method names on untyped receivers, and same-module copies. The port's own tests found five gaps, fixed here: - tree-sitter-cpp strands an explicit operator's name in an `ERROR` sibling (`d.operator+=(c)`), so the argument list was never read and the first overload won; the operator's `operator_name` node is matched instead, comments inside the access included. - a func-typed Go field (`get func() A`) was typed by its first token; the whole type is kept and the call takes the func's result. - Go result typing read a package's function even when a parameter of the package's name shadowed it. - a typed-local receiver kept only the strict scope read, so a rebinding (`store = A(); store = B()`) resolved to nothing; the invocation-time binding decides, with the colbymchenry#2821 refusals intact. - Python inherited members followed breadth-first edge order, so `Adapter(Left, Right)` with `Left(Root)` reached Right's method before Root's; the walk is depth-first along the header, and `*bases` expands its module-level tuple. `isVisibleAcrossFiles` guards name picks only, as upstream does; a typed store action or an imported component value is no unexported-module pick. JS/TS browser host globals are read as the browser's own unless the file binds the name. Golden dumps: `torture-multilang` re-baselined for one Java edge, whose confidence rises 0.4 -> 0.9 because `var x = Method()` now types the receiver; the target is unchanged.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
- Browser host scan: the `typeof` lookbehind now starts on a character
boundary (a non-ASCII byte could panic the slice), and a lexical binding
of the name at the call keeps the name the file's own, which a `${…}`
interpolation's blanked contents cannot hide.
- Python inherited members: `inherited_through` reads Python's C3 order
(each class's own member, not its subtree's) and `python_c3` linearizes
`python_bases`, `*bases` included. The header-position sort in
`python_mro` is reverted: it could match the subclass's own name first
(`class Model(Mixin, parent.Model)`).
- A func-typed Go field stops at `;` and a struct tag, so
`get func() *A; other *B` is `func() *A`.
- The generic-parameter exception is limited to `Recv`/`RecvMsg` on a
binding that is still a parameter, so `s.Header()` does not enable name
matching for a project `Resp.Get`.
- `*bases` is read from the module-level tuple written before the class,
not an earlier function's local.
- python_types.rs: the conditional-binding guard's regex had a literal
backspace instead of `\b`; the chosen conditional binding is now
refused when the evidence conflicts.
Tests: a non-ASCII receiver line, a template interpolation's `document`
parameter, a same-line second Go field with a struct tag, a diamond C3
case, and `class Model(Mixin, parent.Model)`.
|
Review round (GPT-6.1 Sol, xhigh) returned fix-then-ship with seven findings, all fixed in
Also fixed the pre-existing defect the review found: The golden explanation is corrected too: Full suite after the fixes: 11,146 passed, 11 failed — the same 11 that reproduce on pristine origin. |
Ports the resolution behaviour upstream added after the last merged batch (#586, pinned through
8e854d11): browser-host calls (colbymchenry#2907), enclosing-class member calls, Go receiver typing through parameters, func-typed fields and call results (colbymchenry#2543, colbymchenry#2581), library-method names on untyped receivers, and same-module copies. One commit, 19 files, +2,096/−44.What changed
window.open(),localStorage.getItem(),location.reload(), a worker'sself.postMessage()link no project method unless the file binds or imports the name. The rule reads whether the file mentions the name only as a receiver or aftertypeof; the collapsed-object path returns a tri-state (found / the browser's / not ours) sowindow.localStorage.getItem()declines whilewindow.App.init()still resolves; an unboundselfis the global object in both receiver readers.render(),this.render(),super.render()bind to the caller's own class along Python's C3 order, Java's nested-type headers and Scala's siblings.get func() A→ the call isA), call results, range elements, and package shadowing (shadowPkg(store *Holder)makesstore.New()the method, not the package).m.getOrElse,data.put,size) declines unless the receiver's own words name the type; a typed field,this., or a receiver named for the owner keeps it.isVisibleAcrossFilesguards the name strategies only, as upstream does (index.ts:1867), so a typed store action and an imported component value are not treated as unexported module bindings; every language's own privacy still applies.Gaps the port's tests found
d.operator+=(c)as a call on the receiver with the operator name in anERRORsibling, so no argument list was read andoperator+=(int)took a calloperator+=(const Counter&)fits. Theoperator_namenode is matched instead, comments in the access included.go_field_typekept only a func-typed field's first token (func()), losing its result.store = A(); store = B(); store.get()resolved to nothing; the invocation-time binding decides now, with the fix(python): calls like reg.get() on a typed local or parameter reach the class's method colbymchenry/codegraph#2821 refusals (branch/loop/withbindings, outside-project bases) intact.Adapter(Left, Right)withLeft(Root)reachedRight's method beforeRoot's; the walk is depth-first along the header and*basesexpands its module-level tuple.Checks
vitest run: 11,142 passed, 11 failed, 44 skipped (934 files). All 11 failures reproduce on pristineorigin/fork/consolidated(a7e5714b): 8 injs-builtin-method-calls, pluslibrary-receiver-calls(fetch Response),route-inline-handler-calls,sync-typed-local-member-retry. The branch adds none.browser-host-globals,enclosing-class-member-call, three Go files,library-method-calls,same-module-copy-resolution), and the Python suites the receiver change touches (python-self-call-not-import61/61,receiver-scope-lookup69/69,python-typed-builtin-method-calls26/26).torture-multilangre-baselined for one Java edge, confidence 0.4 → 0.9 (refName: norm, target unchanged) because the enclosing-class lookup now reads the barenorm()call insidePoint.compareTo.npm test'scheck:kernel-rulesgate fails onpascal_scope.rsonorigintoo (fixed separately by fix(kernel): unblock npm test on the default branch #584); the suite above isvitest rundirectly.README rows
Checked the "About this fork" tables and the benchmark rows: none move. Resolution correctness only, no command, language, framework, config key or measured README number changes.