haskell / haskell/cabal

Bad parse error for malformed `--constraint` argument

Open
#8,566 4 comments 0 reactions 0 assignees View on GitHub
attention: pr-welcome cabal-install: v2-build system re: constraint re: error-message type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

```
~/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. ""
(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. ""
(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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.