-
Notifications
You must be signed in to change notification settings - Fork 722
Closed
Description
See commercialhaskell/stack#3549 , user reports everything but main-is is vanishing from the executable stanza.
Here is cabal-roundrip-bug.hs, it can be run with stack runghc --resolver nightly-2017-11-04 cabal-roundtrip-bug.hs, and that uses Cabal-2.0.0.2.
import Distribution.PackageDescription
import Distribution.PackageDescription.Parse
import Distribution.PackageDescription.PrettyPrint
main = do
let input = unlines
[ "name: bug"
, "version: 1"
, "build-type: Simple"
, "cabal-version: >= 1.2"
, ""
, "executable bug"
, " default-language: Haskell2010"
]
ParseOk _ parsedInput = parseGenericPackageDescription input
let rendered = showGenericPackageDescription parsedInput
ParseOk _ roundtripped = parseGenericPackageDescription rendered
if parsedInput == roundtripped
then putStrLn "Success!"
else error $ unlines
[ "Mismatch after roundtripping cabal file through render + parse."
, ""
, "-- Input was:"
, ""
, input
, ""
, "-- Input parsed and rendered is:"
, ""
, rendered
]Result is
cabal-roundtrip-bug.hs: Mismatch after roundtripping cabal file through render + parse.
-- Input was:
name: bug
version: 1
build-type: Simple
cabal-version: >= 1.2
executable bug
default-language: Haskell2010
-- Input parsed and rendered is:
name: bug
version: 1
cabal-version: >=1.2
build-type: Simple
license: UnspecifiedLicense
executable bug
CallStack (from HasCallStack):
error, called at cabal-roundtrip-bug.hs:20:10 in main:Main