Repository navigation
fix: keep declaration docstrings when an attribute defines a constant - #1089
Open
fushanbobfan wants to merge 1 commit into
Open
fushanbobfan wants to merge 1 commit into
fushanbobfan wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
verso-literateattaches a doc comment to the largest syntax node that contains exactly one definition site. In@[to_additive foo /-- ... -/] def bar, that node isdeclModifiers, which holdsfoo's definition site andbar's doc comment, sobar's doc comment goes tofoo(#979).What this changes
Attribute instances are handled first, innermost first. An instance with one remaining definition site takes the doc comments inside it and claims that site, and the rest of the command is matched against the sites left over. This follows the idea of the commit linked in the issue and also covers nested attributes such as
@[to_additive (attr := to_additive baz /-- ... -/) foo /-- ... -/].The new fixture
LitConfig.Core.AttrDefinedConstantis an attribute that defines a constant named in the attribute, sinceto_additivelives in Mathlib. It sits underCorebecause the keyboard test intest_accessibility.pyallows ten Tab presses through the navbar, and theCoresubtree is collapsed there.How it was tested
I ran the
runsteps ofci.ymland the other pull request workflows on Debian with TeX Live 2026, Inkscape and Playwright. Results on this branch:lake build,lake lint,./generate.sh,./src/tests/run_serve_test.sh, linkchecker and the type checks passlake test -- --test-options --verbose --wfail --junit=errata-report.xml --markdown=errata-summary.md -- --check-tex: 812 passed, 0 failedsrc/tests/run_literate_browser_tests.sh: 168 passed, 4 skipped; 6 passedbrowser-tests/errata-widget: 55 passed; search, ToC, redirect and KaTeX tests: 118 passed;browser-tests/verso-html: 72 passed, 4 skipped;browser-tests/package-manual: 27 passedWith only
VersoLiterateMain.leanreverted,lake test -- --test-options --wfailfails the new test:The docstring "The docstring of the first declaration." is not associated with AttrDocstrings.first.No-Changelog: bugfix
Fixes #979