Skip to content

Field parser having unhelpful filename in error #11256

@leana8959

Description

@leana8959

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:

$ 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 1e3c355), ghc 9.8.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions