Skip to content

feat: Gleam-style todo/panic typed expressions (ILO-410)#706

Merged
danieljohnmorris merged 2 commits into
mainfrom
feature/todo-panic-exprs
May 22, 2026
Merged

feat: Gleam-style todo/panic typed expressions (ILO-410)#706
danieljohnmorris merged 2 commits into
mainfrom
feature/todo-panic-exprs

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • Adds todo "reason" and panic "reason" as typed expressions that satisfy any return type (like Gleam's divergent expressions)
  • Parser: recognizes todo/panic as contextual identifiers in any expression position, each followed by a mandatory reason expression
  • Verifier: returns Ty::Unknown so both expressions satisfy any expected return type without emitting type errors
  • Tree interpreter: todo raises ILO-R020, panic raises ILO-R021, both include the reason string in the error message
  • VM compiler: emits OP_WRAPERR + OP_PANIC_UNWRAP to abort with the reason at runtime
  • All expression-walking passes updated: graph, codegen/fmt, codegen/python, desugar, alias-resolve, free-var collector

Closes ILO-410.

Test plan

  • cargo test passes (all existing tests green)
  • verify_todo_satisfies_number_return / verify_todo_satisfies_text_return — type checks pass
  • verify_todo_in_branch — todo as one branch of a ternary typechecks
  • todo_expr_produces_runtime_error — ILO-R020 with correct message
  • panic_expr_produces_runtime_error — ILO-R021 with correct message

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 67.10526% with 25 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/codegen/python.rs 0.00% 6 Missing ⚠️
src/vm/mod.rs 0.00% 6 Missing ⚠️
src/interpreter/mod.rs 83.33% 5 Missing ⚠️
src/parser/mod.rs 70.00% 3 Missing ⚠️
src/ast/mod.rs 0.00% 2 Missing ⚠️
src/codegen/fmt.rs 0.00% 2 Missing ⚠️
src/graph.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@danieljohnmorris danieljohnmorris added the mini Created by mini PC autonomous workflow label May 22, 2026
Daniel Morris and others added 2 commits May 22, 2026 10:03
Implements `todo "reason"` and `panic "reason"` as typed expressions that
satisfy any return type at the verifier and abort at runtime with the given
message. Covers parser (contextual idents), AST nodes (Expr::Todo/Panic),
verifier (Ty::Unknown), tree interpreter (ILO-R020/ILO-R021), VM compiler
(OP_WRAPERR + OP_PANIC_UNWRAP), and all expression-walking traversals
(graph, codegen/fmt, codegen/python, desugar, alias-resolve, free-var).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danieljohnmorris danieljohnmorris force-pushed the feature/todo-panic-exprs branch from c768c80 to bcaba1e Compare May 22, 2026 09:03
@danieljohnmorris danieljohnmorris merged commit 885cf99 into main May 22, 2026
9 of 10 checks passed
@danieljohnmorris danieljohnmorris deleted the feature/todo-panic-exprs branch May 22, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mini Created by mini PC autonomous workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant