ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 113 forks source link

ghcid hangs when it encounters unparsable CPP #212

Open chessai opened 5 years ago

chessai commented 5 years ago

example:

-- Example.hs
{-# LANGUAGE CPP #-}

#define = ==

module Example where

main :: IO ()
main = pure ()

when loading this module, ghcid freezes up. however, ghci gives the following:

foo.hs:12:0: error:
     error: macro names must be identifiers
     #define = ==

   |
12 | #define = ==
   | ^
`cc' failed in phase `C pre-processor'. (Exit code: 1)
goolord commented 5 years ago

+1, I have also encountered this issue

ndmitchell commented 5 years ago

I just tried using as above, and it works. Can you explain what hangs and how? Which GHC version, OS and Ghcid version? I tried GHC 8.2 and 8.6, ghcid 0.7.1 and Windows. By "freezes" do you mean never starts? In which case what command line were you using to start ghcid? What's the --verbose output?

chessai commented 5 years ago

I used Ubuntu 16.04, GHC 8.6.2, ghcid 0.7.1. The command i was using was ghcid myfile.hs. By "freezes", i mean that it shows that it's reloading the file indefinitely. I don't have access to the machine until tomorrow and i'll run it with --verbose then

goolord commented 5 years ago

i think if you have the imroper cpp and then run ghcid, you get a proper error but if you run ghcid, everything successfully compiles, and you then write improper cpp, ghcid is stuck at 'Reloading'.

https://gist.github.com/goolord/fa91e3a4f81175a204eff855daef1b65

ndmitchell commented 5 years ago

Even if I have it successfully compiling, then break it, it doesn't go into a loop. Can I get a more complete trace? Particularly the top of the trace until it's repeated a few times (when it does the reload it says why it did it)