Inconsistent handling of `UnqualComponentName`
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
`cabal-install` appears to allow using component names that `Cabal` can't parse. I'm not sure if this a bug with `cabal-install` being too lax or `Cabal` being too strict.
**To Reproduce**
Steps to reproduce the behavior:
```
$ cat example.cabal
cabal-version: >= 1.8
name: example
version: 0.0.0.0
build-type: Simple
executable x-1
build-depends: base
main-is: Main.hs
$ cat Main.hs
main = pure ()
$ cabal v2-run x-1
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
- example-0.0.0.0 (exe:x-1) (first run)
Configuring executable 'x-1' for example-0.0.0.0..
Preprocessing executable 'x-1' for example-0.0.0.0..
Building executable 'x-1' for example-0.0.0.0..
[1 of 1] Compiling Main ( Main.hs, /private/var/folders/dw/qn5kg6091gq3x8_106kw6ptm0000gn/T/tmp.h2GBaNkl/dist-newstyle/build/x86_64-osx/ghc-9.0.1/example-0.0.0.0/x/x-1/build/x-1/x-1-tmp/Main.o )
Linking /private/var/folders/dw/qn5kg6091gq3x8_106kw6ptm0000gn/T/tmp.h2GBaNkl/dist-newstyle/build/x86_64-osx/ghc-9.0.1/example-0.0.0.0/x/x-1/build/x-1/x-1 ...
```
**Expected behavior**
I would expect either `cabal-install` to reject the component for having an invalid name, or for `Cabal` to successfully parse the component name.
**System information**
``` sh
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.7
BuildVersion: 19H1217
$ uname -a
Darwin TayBook.local 19.6.0 Darwin Kernel Version 19.6.0: Thu May 6 00:48:39 PDT 2021; root:xnu-6153.141.33~1/RELEASE_X86_64 x86_64
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.1
$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
```
**Additional context**
I discovered this problem on accident by looking at this package: . It has many components. I eventually narrowed it down to runs of numbers, like `hsc3-berlin-1977`. I assume the parser rejects names like this because they might accidentally be confused with version numbers.
Contributor guide
Assessment
This issue has not been assessed yet.