Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

[TS] Construct project class instances from runtime constructor values

Aberta
#465 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
38/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
kotlin, node.js, typescript
Domínio
compilers, testing-qa

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Kotlin
Estrelas
33
Forks
27
Merge médio
2d 20h
PRs com merge (30d)
10

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de UnitTestBot/usvm

Todas as issues de UnitTestBot/usvm

Issues semelhantes

Mais issues de Kotlin

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.