`.cabal` file "flag used but not defined" error message has inaccurate source location.
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
In a .cabal file like this:
```cabal
cabal-version: 2.4
name: hls-test-utils
version: 2.10.0.0
build-type: Simple
library
hs-source-dirs: src
build-depends:
, base
if flag(unix)
build-depends: unix < 2.9
default-language: GHC2021
```
I get the error message:
```
/home/hugin/Documents/haskell/hls/hls-test-utils/hls-test-utils.cabal:0:0: These flags are used without having been defined: unix
```
Cabal should report exactly where the flag is used but not defined.
This looks especially silly in HLS:

Contributor guide
Research direction
Reproduce the diagnostic with the .cabal example from the issue and trace how the undefined flag in `if flag(unix)` is reported. Done means the error identifies the location where the flag is used rather than reporting `:0:0`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100