Describe the bug
When cabal emits field grammar parser warnings, it does so in reverse. That is, a line comes later in a file comes earlier in the warning. This is inconsistent with ghc's default behaviour.
To Reproduce
-
Write this to a cabal file
cabal-version: 3.0
name: simple
version: 0.1.0.0
common a
build-depends:
library
hs-source-dirs: src
exposed-modules:
App
import: a
import: a
import: a
import: a
-
Run
-
The warning should be something like the following. Note how it goes from line 16 to 13.
This is inconsistent with ghc's default behavior, for example.
Resolving dependencies...
Build profile: -w ghc-9.8.4 -O1
In order, the following will be built (use -v for more details):
- simple-0.1.0.0 (lib) (configuration changed)
Warning: simple.cabal:16:3: Unknown field: import. Common stanza imports
should be at the top of the enclosing section
Warning: simple.cabal:15:3: Unknown field: import. Common stanza imports
should be at the top of the enclosing section
Warning: simple.cabal:14:3: Unknown field: import. Common stanza imports
should be at the top of the enclosing section
Warning: simple.cabal:13:3: Unknown field: import. Common stanza imports
should be at the top of the enclosing section
Expected behavior
The warnings should be in the same order as the file.
System information
- Linux 6.12.47, NixOS, 25.05 (Warbler), 872106a4
- cabal-install version 3.17.0.0 (commit 0c8d69f, Mon Nov 3 19:17:29 2025 +0000)
compiled using version 3.17.0.0 of the Cabal library (in-tree)
Additional context
Maybe someone forgot to flip the warnings accumulator?
Describe the bug
When cabal emits field grammar parser warnings, it does so in reverse. That is, a line comes later in a file comes earlier in the warning. This is inconsistent with ghc's default behaviour.
To Reproduce
Write this to a cabal file
Run
The warning should be something like the following. Note how it goes from line 16 to 13.
This is inconsistent with ghc's default behavior, for example.
Expected behavior
The warnings should be in the same order as the file.
System information
compiled using version 3.17.0.0 of the Cabal library (in-tree)
Additional context
Maybe someone forgot to flip the warnings accumulator?