Repository navigation
resolve: local JS classes, Rust smart-pointer fields, Python C3, Rust inherent methods / 修复 #13–#16:JS 局部类、Rust 智能指针字段、Python C3、Rust 固有方法 - #19
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
修复 #13、#14、#15、#16 报告的四个解析错误。四个都是静默的错边或漏边:索引显示引用全部解析,严格校验也通过。
12d6fd0),只有一个提交f8b1781。cg-core(引擎版本)、cg-extract、cg-resolve、cg-sync和测试,不动 vendored 的cg-kernel。修复
new X()、所建对象上的方法调用、该处的类型引用都连到内层的类。原来同文件查找总是优先顶层声明。Arc<T>、Rc<T>或Box<T>时,self.field.m()透过指针连到T::m。指针自己的方法(Arc、Rc的clone等)仍归指针,不连到T::clone。原来字段路径遇到包装类型就放弃。impl Trait for X里的方法。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.
f8b1781, on merged resolve: close JS/TS, Rust and JVM graph gaps against upstream / 补齐与原版的图谱差距(JS/TS、Rust、JVM) #18 (12d6fd0).cg-core(engine version),cg-extract,cg-resolve,cg-syncand tests; vendoredcg-kernelis untouched.Fixes
new X(), calls on the value it makes, and type references there.self.field.m()looks throughArc<T>,Rc<T>andBox<T>fields toT::m; the pointer's own methods (cloneonArc/Rc) stay the pointer's.impl Trait for Xblocks.结果 / Results
d2e0389作对照,相对 resolve: close JS/TS, Rust and JVM graph gaps against upstream / 补齐与原版的图谱差距(JS/TS、Rust、JVM) #18 的12d6fd0。Strict edge sets against upstream
d2e0389, relative to resolve: close JS/TS, Rust and JVM graph gaps against upstream / 补齐与原版的图谱差距(JS/TS、Rust、JVM) #18 at12d6fd0.Only Tokio changes; P and R are unchanged on the other eleven repositories.
Tokio gains 74 edges, 59 of them in upstream, and loses none.
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 full-index time is unchanged.
验证 / Verification
resolve_e2e新增 4 个测试,修复前失败、修复后通过。Four new
resolve_e2etests fail before and pass after. They cover:clone/ the three pointers and theirclone;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.
12d6fd0复现全部四个问题;本 PR 给出 issue 期望的边,status --verify --strict通过。Python 解释器和 rustc 的运行结果与这些边一致。On the issues' own fixtures,
12d6fd0reproduces all four and this PR gives the expected edges, with strict verification passing. Python and rustc agree with those targets.-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.
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.