Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[TS] Construct project class instances from runtime constructor values

未关闭
#465 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
kotlin, node.js, typescript

调研方向

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 existing instanceof behavior 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

UnitTestBot/usvm 的其他 Issue

查看 UnitTestBot/usvm 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。