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

Aperta
#9 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@tangentstorm ci sta già lavorando.

Dal 29/10/2026.

  • #13 di @tangentstorm — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
6
Fork
1
Merge medio
3m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tangentcode/implish

Tutte le issue di tangentcode/implish

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.