Skip to content

Improve #strata_gen error messages#728

Merged
MikaelMayer merged 13 commits intomainfrom
issue-136-improve-strata-gen-error-messages
Apr 3, 2026
Merged

Improve #strata_gen error messages#728
MikaelMayer merged 13 commits intomainfrom
issue-136-improve-strata-gen-error-messages

Conversation

@MikaelMayer
Copy link
Copy Markdown
Contributor

@MikaelMayer MikaelMayer commented Apr 1, 2026

#strata_gen did not check whether the datatype names it was about to introduce already existed in the Lean environment, leading to confusing errors from the elaborator.

This adds a pre-generation check that resolves each category name (respecting the current namespace and private name mangling) and verifies it is not already defined. When a conflict is found, a clear error message is reported and code generation is aborted.

The name-resolution logic is factored into a shared resolveScopedName helper used by both mkScopedIdent and the new availability check.

Tested: existing tests pass, new test added for the duplicate name scenario.

Fixes #136

…_gen (#136)

Add checkCategoryNamesAvailable that verifies none of the category names
about to be introduced by #strata_gen already exist in the Lean environment.
Reports a clear error message for each collision and aborts generation.
Copy link
Copy Markdown
Contributor Author

@MikaelMayer MikaelMayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-scoped change. The pre-check mirrors the name resolution logic used during generation, the error message is actionable, and the test covers the private-name scenario. One minor duplication note inline.

Comment thread Strata/DDM/Integration/Lean/Gen.lean Outdated
@MikaelMayer MikaelMayer requested a review from joehendrix April 2, 2026 19:44
@MikaelMayer MikaelMayer marked this pull request as ready for review April 2, 2026 21:31
@MikaelMayer MikaelMayer requested a review from a team April 2, 2026 21:31
@MikaelMayer MikaelMayer enabled auto-merge April 3, 2026 16:53
@MikaelMayer MikaelMayer added this pull request to the merge queue Apr 3, 2026
Merged via the queue into main with commit f6e9b3f Apr 3, 2026
15 checks passed
@MikaelMayer MikaelMayer deleted the issue-136-improve-strata-gen-error-messages branch April 3, 2026 17:12
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.

Improve #strata_gen error messages

3 participants