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

[TS] Evaluate instanceof against the runtime constructor value

Fechada
#457 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
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
45/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
kotlin, node.js, typescript

Direção de pesquisa

Start at the current instanceof evaluator and its use of the static EtsIR checkType, then review the focused symbolic-test entry point described in the issue. Account for dependencies JacoDB #390 and UnitTestBot/jacodb#396 before testing. Done means both outcomes share one static RHS type, direct checks remain covered, and generated inputs and results replay in Node.js.

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

Descrição

enhancement

Problem

The current instanceof evaluator uses the static checkType from EtsIR. For a dynamic right-hand side, that type does not identify which constructor object the program actually selected. JacoDB PR #395 therefore marks dynamic checks unsupported instead of reporting a possibly false Boolean.

Minimal TypeScript example

class A {}
class B {}
export function check(useA: boolean): boolean {
  const ctor = useA ? A : B;
  return new A() instanceof ctor;
}

Node.js returns true for check(true) and false for check(false). The ctor expression must be evaluated once; the membership check must use that runtime value, not its static union type.

Expected support

Use the right-hand constructor value and the left-hand object's prototype chain for the supported class-constructor model. Preserve JavaScript behavior for a non-callable RHS (TypeError) where that value is representable. If custom Symbol.hasInstance is outside the current model, report that case as unsupported explicitly.

Acceptance criteria

  • A focused symbolic test obtains both outcomes with the same static RHS type and distinguishes unsupported from failure.
  • Generated inputs and results replay in Node.js.
  • Direct value instanceof A remains covered and correct.

Dependencies: JacoDB #390 (RHS evaluation) and UnitTestBot/jacodb#396 (declared class runtime values). Implement this as a separate USVM PR.

Linguagem predominante
Kotlin
Estrelas
33
Forks
27
Merge médio
3d 21h
PRs com merge (30d)
88

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.