Skip to content

resolve: local JS classes, Rust smart-pointer fields, Python C3, Rust inherent methods / 修复 #13–#16:JS 局部类、Rust 智能指针字段、Python C3、Rust 固有方法 - #19

Merged
NianJiuZst merged 1 commit into
NianJiuZst:mainfrom
columbia11:claude/issue-fixes
Nov 3, 2026

Conversation

@columbia11

@columbia11 columbia11 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

概要

修复 #13、#14、#15、#16 报告的四个解析错误。四个都是静默的错边或漏边:索引显示引用全部解析,严格校验也通过。

修复

Summary

Fixes the four resolution errors reported in #13, #14, #15 and #16. Each was a silently wrong or missing edge: the index reported every reference resolved and strict verification passed.

Fixes

结果 / Results

仓库 / Repo P R
Tokio 82.32 → 82.31 90.01 → 90.16
  • Tokio 的边: 新增 74 条,其中 59 条原版也有;没有丢边。
    Tokio gains 74 edges, 59 of them in upstream, and loses none.
  • 原版没有的 15 条: 逐条对照源码,全部正确。
    All 15 edges upstream lacks were checked against the source and are correct:
    • Arc<Mutex<…>> 字段 → loom/std 的 Mutex::lock;
    • Arc<Inner<T>> → Inner::with_lock;
    • Arc<TcpStream>、Arc<UnixStream> → try_read_buf;
    • Rc<Context> → Context::spawn。
  • 索引耗时: Tokio 全量索引耗时不变。
    Tokio full-index time is unchanged.

验证 / Verification

  • 测试先行。 resolve_e2e 新增 4 个测试,修复前失败、修复后通过。
    Four new resolve_e2e tests fail before and pass after. They cover:
    • TS 和 JS 两种写法 / both TS and JS;
    • 三种指针及其 clone / the three pointers and their clone;
    • C3 的菱形继承 / a C3 diamond;
    • 跨文件和同文件的 impl / impls across files and in one file;
    • 只有 trait 方法时仍连到 trait 方法 / a trait-only method.
  • 增量同步。 新增 shadowing_edits_match_full_rebuild,用单独的小 fixture 把每项修复来回切换,每一步都与全量重建比对。去掉父类顺序键或 trait-impl fact 签名时,这个测试会失败。
    A new parity test flips each fix back and forth on its own fixture and compares every step with a full rebuild. It fails when the base-order key or the trait-impl fact signature is removed.
  • 真实 CLI。 用 issue 里的原始例子:12d6fd0 复现全部四个问题;本 PR 给出 issue 期望的边,status --verify --strict 通过。Python 解释器和 rustc 的运行结果与这些边一致。
    On the issues' own fixtures, 12d6fd0 reproduces all four and this PR gives the expected edges, with strict verification passing. Python and rustc agree with those targets.
  • 本地 CI 检查。 rustfmt、clippy(-D warnings)和 workspace 测试全部通过。
    rustfmt, clippy with -D warnings, and the workspace tests pass locally.

需要注意 / Notes

  • 语句块里的类。 if 等语句块里声明的类,仍视为整个函数可见。
    A class declared in a block is treated as visible in the whole function.
  • 跨文件改字段类型。 一个文件改了结构体字段的类型时,增量同步不会重新解析其他文件里经过这个字段的调用。普通字段原来就是这样,bug: Rust method calls through Arc/Rc/Box fields remain unresolved #14 让更多的边依赖这一点。
    When a field's type changes in one file, sync does not re-resolve calls through that field in other files. This already held for plain fields; bug: Rust method calls through Arc/Rc/Box fields remain unresolved #14 makes more edges depend on it.
  • 完全限定调用。 <Worker as Action>::run(w) 仍然不解析,修复前后一样。trait 方法到实现的分发边也没有变化。
    <Worker as Action>::run(w) stays unresolved, as before; trait-to-implementation dispatch edges are unchanged.

Fixes #13, fixes #14, fixes #15, fixes #16.

… inherent methods

- JS/TS: a class declared in a function shadows a same-named outer class for
  `new X()`, the constructed value's method calls and type references there
  (NianJiuZst#13).
- Rust: `self.worker.m()` resolves through `Arc`, `Rc` and `Box`
  fields; the pointer's own methods (`clone`) stay the pointer's (NianJiuZst#14).
- Python: members follow the C3 method resolution order. Bases keep the order
  they are written in, for every language, and incremental sync re-resolves
  when that order changes (NianJiuZst#15).
- Rust: an inherent method shadows a trait impl's method of the same name,
  whichever file each impl is in. Several impls of one type are chosen by
  path and line, so a base/delta split cannot decide (NianJiuZst#16).

Engine version 11: the extractor records which Rust methods belong to trait
impls.

Fixes NianJiuZst#13, fixes NianJiuZst#14, fixes NianJiuZst#15, fixes NianJiuZst#16.
@NianJiuZst
NianJiuZst merged commit 101ec94 into NianJiuZst:main Nov 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants