Repository navigation
Use parsec parser for project round trip prop tests - #12139
Open
philderbeast wants to merge 41 commits into
Open
philderbeast wants to merge 41 commits into
philderbeast wants to merge 41 commits into
Conversation
philderbeast
force-pushed
the
test/parsec-parser-roundtrip-prop
branch
2 times, most recently
from
July 22, 2026 13:23
34a1357 to
e3e2ebc
Compare
philderbeast
marked this pull request as draft
July 23, 2026 18:02
philderbeast
force-pushed
the
test/parsec-parser-roundtrip-prop
branch
4 times, most recently
from
August 1, 2026 13:22
d37626a to
fbe026e
Compare
philderbeast
force-pushed
the
test/parsec-parser-roundtrip-prop
branch
from
August 25, 2026 14:42
fbe026e to
7e7f319
Compare
philderbeast
force-pushed
the
test/parsec-parser-roundtrip-prop
branch
from
September 23, 2026 17:27
7e7f319 to
14b3e12
Compare
philderbeast
marked this pull request as ready for review
September 29, 2026 14:08
- Add haddocks for flagToDebugInfoLevel
- Legacy parser gave Flag "" - Parsec parser gives NoFlag
- Add readConfigDiverging
philderbeast
force-pushed
the
test/parsec-parser-roundtrip-prop
branch
from
September 29, 2026 15:14
5772938 to
1769cc9
Compare
This was referenced Sep 29, 2026
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.
I've started working on #12138. This changes the property tests for round trip printing and parsing of projects to parse with the parsec parser from #8889 as well as with the legacy parser. The legacy printer is still the one doing the printing and the legacy parser is the oracle: both parsers have to read back the generated config.
Adds
parseProjectConfigand exports this fromDistribution.Client.ProjectConfig.Parsec. This is used for testing and is the parsec equivalent ofparseLegacyProjectConfig. It could be defined in the test suite but then we'd have to exportfieldsToConfigandreadPreprocessFieldsinstead.I'll squash commits before applying the merge label if this pull request is approved.
Fixes
Running the round trip against the parsec parser found these, each fixed and tested:
debug-info: Trueanddebug-info: Falseweren't parsed, only the numeric levels were. The same conversion backs--enable-debug-info=so that's fixed too.max-backjumps: -1wasn't parsed. The option and the docs both allow a negative number for unlimited backtracking.packages: ../{foo,bar}/, were split at the commas.project-file-parseras a field, an accident of lifting all the command line options into fields. The parser is chosen before the file is read so the value could never have an effect. Both parsers now warn about it, parsec saying why, and there's a package test showing each.file+noindex:repository kept the URI's forward slashes where the legacy parser normalises it. Only visible on Windows. Both parsers now read it withfileNoIndexURIPath, the inverse ofnormaliseFileNoIndexURI, with haddocks and doctests on both saying which direction each is for.Kept differences
Two differences are kept and documented rather than fixed, as the parsec parser has the better behaviour:
test-log:say, isFlag ""for legacy and unset for parsec.The generators avoid these inputs, with comments saying why, and the parser tests assert the differing results explicitly.
Tests
-- $setup), so they show what a project file does rather than what a hand-built field does.Follow-ups, stacked on this PR, compare both parsers over every project file in
cabal-testsuiteand turn+legacy-comparisonback on in validate now that the legacy pass no longer repeats the import warnings.+legacy-comparisonto the validate project #12394Note
I started down this path by hand, switching the round trip to the parsec parser and chasing the first failures, the ones shown below. The rest was done with the help of Claude Fable 5.1: working through the remaining failures one commit at a time, the Windows local repository path, the doctests, and the parser test oracle.
Differences
These are the failures I found by hand at the start, before the fixes above.
There are test failures with commas in the packages field:
There are test failures with commas in the shared test:
There's a test failure in the local test parsing the debug level:
There's a test failure in the specific test parsing the debug level (same goes for the all test):
QA notes
With a project file containing any of the lines in the snippet below,
cabal build --dry-run --project-file-parser=parsecused to fail to parse and now doesn't. With the default fallback parser it used to fall back to the legacy parser and now doesn't need to, which-v2shows.On Windows, a
repositorysection with afile+noindex:C:/some/pathurl now gives the sameC:\some\pathunder both parsers, so--project-file-parser=compareaccepts it.max-backjumpsfield type is nowintegerrather than
nat, matching the -1 the text already describes.