x/y/z bindings not restored when a function body throws

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

@tangentstorm já está trabalhando nisso.

Desde 29/10/2026.

  • #13 de @tangentstorm — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
25/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
typescript
Domínio
compilers

Direção de pesquisa

Read imp-eval.mts around line 495, where the saved x, y, and z bindings are restored after function evaluation. Reproduce the reported sequence (x: 10, f: {x + bad}, then f[99]) and check the value of x after catching the error. Done means the original bindings remain intact after a function body throws; an open linked pull request already addresses this issue.

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

Descrição

approved follow-up

From the Codex whole-repo review on #5 (review comment).

Location: imp-eval.mts:495 on main (6813323)

[P2] Restore parameter bindings when a function body throws

If lastEval throws, execution skips restoration of the saved x, y, and z bindings, leaving function arguments in the shared word dictionary. In separate evaluations, x: 10, f: {x + bad}, and f[99] demonstrate this: after catching the undefined-word error, evaluating x returns 99 rather than 10. Since the REPL and MCP worker catch evaluation errors and continue using that dictionary, a failed call silently corrupts subsequent program state. Restore the bindings in a finally block.

Checked 2026-10-29: still present on main; not touched by open PRs #3, #4 or #7.

Linguagem predominante
TypeScript
Estrelas
6
Forks
1
Merge médio
3min
PRs com merge (30d)
1

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 tangentcode/implish

Todas as issues de tangentcode/implish

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

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