Skip to content

Fix #650: StrataVerify Panic in Type inference#730

Merged
MikaelMayer merged 9 commits into
mainfrom
issue-650-strataverify-panic-in-type-inference
Apr 3, 2026
Merged

Fix #650: StrataVerify Panic in Type inference#730
MikaelMayer merged 9 commits into
mainfrom
issue-650-strataverify-panic-in-type-inference

Conversation

@MikaelMayer
Copy link
Copy Markdown
Contributor

Fixes #650

Problem

inferType panicked with "Cannot instantiate type" when a function's type parameter could not be inferred during DDM elaboration. This happened when an earlier type mismatch (e.g., from a || expression being parsed where a datatype was expected) left a type parameter slot unfilled, causing a default placeholder to appear where a .type argument was expected.

Solution

Replace the panic! in the instTypeM callback within inferType with a logError call and a default type return. This allows elaboration to continue and report the actual type errors to the user instead of crashing.

Testing

  • Existing tests pass
  • Added a regression test reproducing the exact program from the issue

…pe parameter inference

When a function's type parameter could not be inferred (e.g., due to an
earlier type mismatch), inferType would panic with 'Cannot instantiate type'.
This occurred because the default Tree (produced when type inference fails)
generates an .op argument where .type was expected.

Replace the panic! in the instTypeM callback with a logError call and a
default type return, allowing elaboration to continue and report the
actual type errors to the user.

Add a regression test reproducing the exact program from the issue.
MikaelMayer

This comment was marked as resolved.

@MikaelMayer MikaelMayer marked this pull request as ready for review April 2, 2026 21:35
@MikaelMayer MikaelMayer requested a review from a team April 2, 2026 21:35
@MikaelMayer MikaelMayer enabled auto-merge April 3, 2026 12:45
@MikaelMayer MikaelMayer added this pull request to the merge queue Apr 3, 2026
Merged via the queue into main with commit b94a35e Apr 3, 2026
15 checks passed
@MikaelMayer MikaelMayer deleted the issue-650-strataverify-panic-in-type-inference branch April 3, 2026 13:53
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.

StrataVerify Panic in Type inference

3 participants