Source
Jelly micro-test benchmark (PR #1304). classes scores 9% recall (3/32 edges), classes2 0% (0/18). Most misses are instance method calls on new-constructed objects.
Pattern
class C1 {
constructor() { f1(); }
f7(y) { return y(); }
f8 = () => { return f1; }
}
let t2 = new C1;
t2.f7(f2); // ← missed: t2 is C1, should resolve C1.f7
let t222 = t2.f8(); // ← missed: field accessor, resolves C1.f8
Also includes static class members:
class C6 {
static staticMethod() { return f1(); } // ← f1->C6.staticMethod missed
static { f1(); } // ← static block call missed
}
C6.staticMethod(); // ← missed
Root cause
Codegraph tracks new ClassName() constructors but doesn't associate the resulting instance variable's type with the class. So t2.f7() is unresolved because codegraph doesn't know t2: C1.
The same gap affects class field arrows (f8 = () => ...) and static member access (C6.staticMethod).
What's needed
new-assignment type tracking: when const x = new Foo(), record x: Foo as a type annotation
- Static member resolution:
ClassName.method() calls should resolve directly to the class's static method without needing instance tracking
- Static block calls: calls inside
static { ... } blocks should be attributed to the class
Impact
Fixture
tests/benchmarks/resolution/fixtures/jelly-micro/classes/classes.js
References
Source
Jelly micro-test benchmark (PR #1304).
classesscores 9% recall (3/32 edges),classes20% (0/18). Most misses are instance method calls onnew-constructed objects.Pattern
Also includes static class members:
Root cause
Codegraph tracks
new ClassName()constructors but doesn't associate the resulting instance variable's type with the class. Sot2.f7()is unresolved because codegraph doesn't knowt2: C1.The same gap affects class field arrows (
f8 = () => ...) and static member access (C6.staticMethod).What's needed
new-assignment type tracking: whenconst x = new Foo(), recordx: Fooas a type annotationClassName.method()calls should resolve directly to the class's static method without needing instance trackingstatic { ... }blocks should be attributed to the classImpact
classesandclasses2fixturesthis.prop = new Foo()Fixture
tests/benchmarks/resolution/fixtures/jelly-micro/classes/classes.jsReferences