[TS] Construct project class instances from runtime constructor values
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 38/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- kotlin, node.js, typescript
- 领域
- compilers, testing-qa
调研方向
Start by tracing how the TypeScript symbolic executor allocates new expressions and how JacoDB EtsIR represents evaluated constructor operands, with dependency UnitTestBot/jacodb#398 in view. Add a focused symbolic test covering both classes, constructor identity, evaluation order, and unsupported values, then replay generated inputs and results in Node.js. Done means direct construction and existing instanceof behavior still pass, while unsupported and failed cases remain distinct.
由索引模型根据 Issue 内容生成。
描述
Problem
The TypeScript symbolic executor allocates new expressions by an EtsIR class type. That cannot execute new through an evaluated constructor value: a variable or call may choose between classes with the same static type. The JacoDB frontend currently marks this form unsupported while its EtsIR representation is being extended.
Minimal TypeScript example
class A { value: number; constructor(value: number) { this.value = value; } }
class B { value: number; constructor(value: number) { this.value = value; } }
function choose(useA: boolean): typeof A | typeof B {
return useA ? A : B;
}
export function check(useA: boolean): boolean {
const value = new (choose(useA))(7);
return value instanceof A && value.value === 7;
}
Node.js returns true for check(true) and false for check(false).
Expected support
Consume the evaluated constructor operand from JacoDB EtsIR and allocate an instance of the selected project class. Invoke that class's constructor once with the evaluated arguments; preserve callee-before-arguments order and constructor identity across calls and local aliases. Keep unknown or symbolic constructor identities explicitly unsupported until they have a sound model. A non-constructable value must not silently allocate an instance.
Acceptance criteria
- A focused symbolic test obtains both outcomes from one static constructor-union type, with unsupported and failures reported separately.
- Generated concrete inputs and results replay in Node.js, including a constructor returned by another function and an argument that mutates the constructor variable after the callee has been selected.
- Direct
new A()and existinginstanceofbehavior remain correct.
Dependency: UnitTestBot/jacodb#398. Related: JacoDB #396 for declared class runtime values and USVM #457 for runtime instanceof.
- 主要语言
- Kotlin
- 星标
- 33
- 派生
- 27
- 平均合并
- 2 天 20 小时
- 30 天内合并 PR
- 10
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
UnitTestBot/usvm 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
UnitTestBot/usvm#467 ·
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 55/100
UnitTestBot/usvm#462 ·
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 45/100
UnitTestBot/usvm#457 ·
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 48/100
UnitTestBot/usvm#440 ·
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 55/100
UnitTestBot/usvm#439 ·
维护者通常 1 天内回复
相似的 Issue
-
area/docs
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 72/100
nightscout/AndroidAPS#5199 · 2 条评论 ·
维护者通常 1 天内回复
-
edi-adapter-client enhancement helsemelding-edi-adapter
难度 2/5 1-3 小时 新手友好度 68/100
navikt/helsemelding-edi-adapter#102 ·
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 68/100
oblador/react-native-keychain#818 ·