Skip to content

fix(Cabal): Accept boolean values for debug-info and optimization levels - #12202

Open
zlonast wants to merge 5 commits into
haskell:masterfrom
zlonast:zlonast/boolean-debug-info
Open

fix(Cabal): Accept boolean values for debug-info and optimization levels#12202
zlonast wants to merge 5 commits into
haskell:masterfrom
zlonast:zlonast/boolean-debug-info

Conversation

@zlonast

@zlonast zlonast commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

fix: #12140

debug-info: False ​​are treated as NoDebugInfo, and debug-info: True ​​are treated as NormalDebugInfo


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@zlonast
zlonast requested a review from philderbeast August 21, 2026 12:47
Comment thread Cabal/src/Distribution/Simple/Compiler.hs Outdated
Comment thread changelog.d/12202.md Outdated

@philderbeast philderbeast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we're parsing booleans for debug-info in the project, would that also apply to the command line? If not, is error the best message?

$ cabal build --help
...
--enable-debug-info[=n]        Emit debug info (n is 0--3, default is 0)
--disable-debug-info           Don't emit debug info
$ cabal run cabal-install:exe:cabal -- build all --dry-run \
   --enable-debug-info=True
...
Can't parse debug info level True

HasCallStack backtrace:
  error, called at src/Distribution/Simple/Compiler.hs:383:8 in
  Cabal-3.19.0.0-inplace:Distribution.Simple.Compiler

$ cabal-3.18.1.0 build all --dry-run --enable-debug-info=True
Can't parse debug info level True
CallStack (from HasCallStack):
  error, called at src/Distribution/Simple/Compiler.hs:392:8 in
  Cabal-3.18.1.0-inplace:Distribution.Simple.Compiler

@zlonast

zlonast commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@philderbeast Thanks for such a detailed review, yes, I think this approach should be applied to the command line as well.

@zlonast
zlonast force-pushed the zlonast/boolean-debug-info branch from d922696 to cb58f67 Compare August 22, 2026 06:16
@zlonast zlonast changed the title fix(Cabal): Fix parsing of boolean values to debug-info fix(Cabal): Accept boolean values for debug-info and optimization levels Aug 22, 2026
@zlonast
zlonast requested a review from philderbeast August 22, 2026 06:50
@zlonast zlonast added re: flag Concerning user-defined flags in cabal files re: options Concerning command-line options labels Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attention: needs-review re: flag Concerning user-defined flags in cabal files re: options Concerning command-line options

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parsec project parser can't parse debug-info boolean

3 participants