Field parser having unhelpful filename in error
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
Having a cabal file that is not of valid field syntax would trip the field parser. The field parser is run with a hardcoded filepath "the input" and the error message is unhelpful as it mentions "the input".
The outer parser would also trip (the one with the correct filepath) and this emits two filenames in the error.
```
Errors encountered when parsing cabal file ./simple.cabal:
simple.cabal:1:1: error:
"the input" (line 1, column 1):
unexpected operator ","
expecting field or section name
1 | ,
| ^
```
**To Reproduce**
Steps to reproduce the behavior:
```bash
$ echo "," > simple.cabal
$ cabal build
```
**Expected behavior**
One single correct filepath being indicated
**System information**
- `Linux 6.12.47, NixOS, 25.05 (Warbler), 872106a4`
- `cabal` 3.14.2.0 (present in master branch revision 1e3c355eeab89fa8894ce9c6e4e649903e58d6b3), ghc 9.8.4
Contributor guide
Research direction
Start with the field parser path exercised by `cabal build` and compare its hardcoded "the input" filepath with the filepath passed by the outer parser. Reproduce the issue using a `simple.cabal` containing `,`; done means the error reports one correct filepath instead of two.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100