Skip to content

fix: strip @[eval_problem] when it shares a line with the declaration - #543

Merged
kim-em merged 1 commit into
mainfrom
generator/inline-eval-problem
Aug 21, 2026
Merged

fix: strip @[eval_problem] when it shares a line with the declaration#543
kim-em merged 1 commit into
mainfrom
generator/inline-eval-problem

Conversation

@kim-em

@kim-em kim-em commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

This PR makes stripProblemMarkers remove an @[eval_problem] attribute that shares a line with the declaration it marks, rather than only one that occupies the whole line. The stripper split on the first ] only when the trimmed line also ended in ], so @[eval_problem] theorem foo : ... passed through untouched into the generated Challenge.lean, where import EvalTools.Markers has been stripped, and the build failed with Unknown attribute [eval_problem]. Sibling attributes are preserved in place, so @[eval_problem, simp] theorem foo becomes @[simp] theorem foo.

Only multi-hole modules were affected in practice: the target declaration is rewritten from its statement, so its own attribute never reaches the output, but a second marked declaration in the same module is emitted verbatim as context. #191 is currently red for exactly this reason, and #521 carries a commit titled "@[eval_problem] on separate line" working around it by hand.

🤖 Prepared with Claude Code

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011hxUxCg6joVz4hMa3m5Zh5
@kim-em
kim-em merged commit 8815c22 into main Aug 21, 2026
13 checks passed
@kim-em
kim-em deleted the generator/inline-eval-problem branch August 21, 2026 02:26
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.

1 participant