Make a trailing colon for stanzas a parse failure
commit1cee4811d50d212c302236eaf1bcd65af00260e4
authorRebecca Turner <rbt@sent.as>
Mon, 4 Nov 2024 22:48:50 +0000 (4 14:48 -0800)
committerMikolaj <281893+Mikolaj@users.noreply.github.com>
Sat, 23 Nov 2024 17:56:25 +0000 (23 17:56 +0000)
tree39b1cf5a43135718a779663d18f3e84c333ff6f6
parent2f871db2276af601be1d031c0d022bdde335b7ca
Make a trailing colon for stanzas a parse failure

Here's a mistake I make semi-regularly:

    source-repository-package:
        type: git
        location: https://github.com/parsonsmatt/foundation
        tag: 688c32ccd9a951bc96dd09423a6e6684f091d510
        subdir: basement
        subdir: foundation

Cabal treats this as a warning, so it prints:

    Warning: cabal.project: Unrecognized field
    'source-repository-package' on line 52

This is fine (if you already know the mistake you've made, at least!),
but it's very easy to miss amidst lots of output.

I often re-run `cabal` when I see a ton of output to attempt to get a
smaller error message. (Usually it works and I get an error message
that's got less "compiling module such and such" noise in it.) However,
re-running `cabal` will discard this warning entirely!

Let's make it a hard error instead. This is a backwards-compatibility
break.
cabal-install/src/Distribution/Client/ParseUtils.hs
cabal-install/src/Distribution/Deprecated/ParseUtils.hs
cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.out [new file with mode: 0644]
cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.project [new file with mode: 0644]
cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.test.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/src/MyLib.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/test.cabal [new file with mode: 0644]
changelog.d/pr-10525 [new file with mode: 0644]