Opened 7 months ago

Last modified 7 months ago

#16167 new bug

-ddump-json doesn't work with -e

Reported by: shmish111 Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.6.3
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: Incorrect error/warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

If I create a haskell file called, for example, Main.hs which does not compile and run ghc -ddump-json Main.hs I will get a json formatted output after the error messages. This is a list of the errors, as expected. However if I run runghc -ddump-json Main.hs I get an empty list at the end []

Change History (5)

comment:1 Changed 7 months ago by mpickering

Did you try with 8.6? Behaviour should be at least different due to fixing #14078.

comment:2 Changed 7 months ago by shmish111

Interesting, with 8.6.3 there is no output at all, also -ddump-json -ddump-to-file does not produce a file (I guess that makes sense based on the fact that -ddump-json seems to not do anything.

comment:3 Changed 7 months ago by mpickering

With 8.6.2,

> ghc f.hs -fforce-recomp  -ddump-json
{"span": null,"doc": "Loaded package environment from /root/sql-haskell/.ghc.environment.x86_64-linux-8.6.2","severity": "SevInfo","reason": null}
{"span": {"file": "f.hs","startLine": 1,"startCol": 8,"endLine": 1,"endCol": 9},"doc": "parse error on input \u2018f\u2019","severity": "SevError","reason": null}
> runghc f.hs  -fforce-recomp  -ddump-json
Loaded package environment from /root/sql-haskell/.ghc.environment.x86_64-linux-8.6.2

f.hs:1:8: error: parse error on input ‘f’
  |
1 | module f
  |   

I'm not sure why runghc behaves differently.

comment:4 Changed 7 months ago by shmish111

Ok, I seem to have narrowed it down to the -e ":set prog Main.hs" flag

[nix-shell:~]$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.4

[nix-shell:~]$ ghc -x hs -e ":set prog Main.hs" -ddump-json Main2.hs

Main2.hs:4:8: error:
    • Variable not in scope: undefinedx :: IO ()
    • Perhaps you meant ‘undefined’ (imported from Prelude)
  |
4 | main = undefinedx
  |        ^^^^^^^^^^
[]

[nix-shell:~]$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.3

[nix-shell:~]$ ghc -x hs -e ":set prog Main.hs" -ddump-json Main2.hs

Main2.hs:4:8: error:
    • Variable not in scope: undefinedx :: IO ()
    • Perhaps you meant ‘undefined’ (imported from Prelude)
  |
4 | main = undefinedx
  |        ^^^^^^^^^^

Last edited 7 months ago by shmish111 (previous) (diff)

comment:5 Changed 7 months ago by mpickering

Keywords: newcomer added
Operating System: MacOS XUnknown/Multiple
Summary: -ddump-json output empty with runghc-ddump-json doesn't work with -e
Version: 8.4.38.6.3

Ok, so it seems that -ddump-json doesn't work with -e. Shouldn't be too hard to fix if someone feels inclined. Thanks for narrowing it down.

Note: See TracTickets for help on using tickets.