Skip to content

Bad parse error for malformed --constraint argument #8566

@sjakobi

Description

@sjakobi
~/s/tomland|main⚡*
➤ cabal test --constraint 'mtl >= 2.3' --constraint=ghc:installed
Error: cabal: invalid argument to option `--constraint': expected a (possibly
qualified) package name followed by a constraint, which is either a version
range, 'installed', 'source', 'test', 'bench', or flags. "<eitherParsec>"
(line 1, column 5):
unexpected "i"
expecting "setup."
~/s/tomland|main⚡*
➤ cabal test --constraint 'mtl >= 2.3' --constraint=ghc:'installed'
Error: cabal: invalid argument to option `--constraint': expected a (possibly
qualified) package name followed by a constraint, which is either a version
range, 'installed', 'source', 'test', 'bench', or flags. "<eitherParsec>"
(line 1, column 5):
unexpected "i"
expecting "setup."
➤ cabal --version
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library 

The error message suggests that installed (or 'installed'?!) is a valid constraint, but the parser doesn't accept it.

BTW, I think that the "followed by" bit could be clearer. Maybe an example could point out that a colon is required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    attention: pr-welcomecabal-install: v2-build systemAffecting v2-build and related commands that use v2-architecture (aka "nix local builds").re: constraintConcerning the constraint syntax, field, and command-line optionre: error-messageConcerning error messages delivered to the usertype: enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions