Skip to content

Implement AST multi-error recovery - #383

Open
LesterEvSe wants to merge 4 commits into
BlockstreamResearch:masterfrom
LesterEvSe:feat/ast-multierrors
Open

Implement AST multi-error recovery#383
LesterEvSe wants to merge 4 commits into
BlockstreamResearch:masterfrom
LesterEvSe:feat/ast-multierrors

Conversation

@LesterEvSe

Copy link
Copy Markdown
Collaborator

Analysis now reports every independent error in one pass instead of stopping at
the first.

  • Poison, not fake values; Error variants in the parse tree, AST, and type
    system (TypeInner::Error); recovery emits these instead of fabricated units,
    aliases, or sizes.
  • No cascades; poisoned types are absorbed during analysis (is_error guards
    and ResolvedType::compatible), so one broken construct does not spawn secondary
    errors.
  • Collect, do not abort; Scope carries a diagnostics sink; containers record
    an error and keep analyzing siblings, and Program::analyze returns Option.
  • Parser split; parse_from_str (fragments, first error) vs
    parse_from_content (files, collect all), over one shared core.

@LesterEvSe
LesterEvSe requested a review from KyrylR July 28, 2026 15:51
@LesterEvSe LesterEvSe self-assigned this Jul 28, 2026
@LesterEvSe
LesterEvSe requested a review from delta1 as a code owner July 28, 2026 15:51
This was linked to issues Jul 28, 2026
@LesterEvSe
LesterEvSe force-pushed the feat/ast-multierrors branch 7 times, most recently from ad880be to a378398 Compare July 30, 2026 13:43
@LesterEvSe
LesterEvSe force-pushed the feat/ast-multierrors branch 2 times, most recently from 864fdcd to 471d4a7 Compare August 5, 2026 13:56
@LesterEvSe
LesterEvSe force-pushed the feat/ast-multierrors branch 3 times, most recently from 5b353a1 to fdd2abb Compare August 12, 2026 11:23
@LesterEvSe
LesterEvSe force-pushed the feat/ast-multierrors branch from fdd2abb to 5202cc8 Compare August 12, 2026 14:06
@apoelstra

Copy link
Copy Markdown
Contributor

In 763b2d8:

I think we should call the Error type "Uninhabited" (or "Never" if we want to be Rust-like), and similarly the is_error method should be is_uninhabited (or is_never or is_empty ... though I think is_empty would be confusing because it's such a common name in Rust).

The empty type has the properties you want -- it cannot be constructed, no code should ever be compiled which accepts it, and there is a unique function mapping it to every other type, and I'd like to add it to the language anyway, so we might as well add it here.

In 8a1b03c:

Adds a blank line to witness.rs, otherwise doesn't touch the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error recovery in analysis Implement error states in parser

2 participants