Abstract methods block coverage and direct calls when no subclass exists
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- compilers
调研方向
Start by reading the compiler paths that handle abstract method declarations, untyped property lookup, and direct calls; the issue gives reproductions but names no source files or tests. Compare the two examples with Node and inspect the existing SC1090 handling. Done means coverage treats abstract declarations as having no runtime value and direct calls match Node’s receiver, argument, and TypeError behavior. A linked pull request is already open.
由索引模型根据 Issue 内容生成。
描述
Abstract methods block coverage and direct calls when no subclass exists
The compiler refuses or defers abstract methods in two shapes that JavaScript handles.
Untyped lookup
A value held as any whose instances reach o[k] gets a branch per class and member. For an abstract method, the branch asks for the method's value, which an abstract declaration does not have. Every such branch is deferred with SC1090 values of abstract method declarations. The program runs and matches Node, but coverage never reports it as fully static.
abstract class Holder {
abstract current(): string;
}
class Impl extends Holder {
current(): string {
return "ok";
}
}
const read = (o: any, k: string) => o[k];
const impl: Holder = new Impl();
console.log(read(impl, "current"), impl.current());
On 0.4.8, scriptc coverage of the larger form in our corpus (abstract-methods-untyped-lookup.ts) reports 6 deferred sites. The same failure reproduces on main (979a65246).
Direct call
A concrete method that calls an abstract method with no concrete implementation below the receiver's static class is refused at build time, even when the program never subclasses the class. tsc makes every instantiable subclass implement the method, so no instance can reach the call.
abstract class Source {
abstract count(): number;
liveFrom(): number {
return this.count();
}
}
class Shelf {
source: Source | null = null;
}
const shelf = new Shelf();
console.log(shelf.source === null ? "none" : shelf.source.liveFrom());
Node prints none. On 0.4.8, the build fails with SC1090 calls of the abstract method 'count' with no concrete implementation below the receiver's static class.
An abstract declaration has no value at run time. An untyped lookup should select the implementation of the constructible subclass the instance belongs to, nearest first, and read undefined when no class below the receiver implements it. A direct call should evaluate its receiver and arguments, then throw Node's TypeError, <callee> is not a function.
I opened #TBD with a patch that implements both behaviors.
- 主要语言
- TypeScript
- 星标
- 6.5k
- 派生
- 212
- 平均合并
- 13 小时 6 分钟
- 30 天内合并 PR
- 799
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vercel-labs/scriptc 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
vercel-labs/scriptc#3416 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
vercel-labs/scriptc#3415 ·
维护者通常 1 天内回复
-
readline: named stdin/stdout imports not recognized as createInterface input/output可能已有人在做 @espetro 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
vercel-labs/scriptc#3414 ·
维护者通常 1 天内回复
-
@types/node collides with scriptc-node-fallback.d.ts in projects without tsconfig.json可能已有人在做 @espetro 今天认领。 未关闭
难度 4/5 1-2 天 新手友好度 20/100
vercel-labs/scriptc#3413 ·
维护者通常 1 天内回复
-
island: ESM module with 'module.exports' named export loses its default export across the boundary可能已有人在做 @espetro 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 25/100
vercel-labs/scriptc#3412 ·
维护者通常 1 天内回复
查看 vercel-labs/scriptc 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
prime-radiant-inc/evener#5901 ·
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
Bug: Batcher binds the texture that opens a new batch twice (one draw call per element with maxBatchableTextures = 1)可能已有人在做 @darzarzycki 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 2 天内回复
-
area:study-data p2-high ready-for-agent type:chore
难度 2/5 1-3 小时 新手友好度 78/100
fderuiter/deruiter.dev#3706 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
nicobailon/pi-subagents#3242 ·
维护者通常 1 天内回复