catching mutual module import.

This commit is contained in:
Kazu Yamamoto 2012-02-13 10:39:37 +09:00
parent cd4a839f35
commit 8deb1cd57c

View File

@ -57,10 +57,9 @@ ppErrMsg err = ppMsg spn msg defaultUserStyle ++ ext
ppMsg :: SrcSpan -> Message -> PprStyle -> String ppMsg :: SrcSpan -> Message -> PprStyle -> String
#if __GLASGOW_HASKELL__ >= 702 #if __GLASGOW_HASKELL__ >= 702
ppMsg (UnhelpfulSpan _) _ _ = undefined
ppMsg (RealSrcSpan src) msg stl ppMsg (RealSrcSpan src) msg stl
#else #else
ppMsg src msg stl ppMsg src msg stl | isGoodSrcSpan src
#endif #endif
= file ++ ":" ++ line ++ ":" ++ col ++ ":" ++ cts ++ "\0" = file ++ ":" ++ line ++ ":" ++ col ++ ":" ++ cts ++ "\0"
where where
@ -68,12 +67,13 @@ ppMsg src msg stl
line = show (srcSpanStartLine src) line = show (srcSpanStartLine src)
col = show (srcSpanStartCol src) col = show (srcSpanStartCol src)
cts = showMsg msg stl cts = showMsg msg stl
ppMsg _ _ _ = "ghc-mod:0:0:Probably mutual module import occurred\0"
---------------------------------------------------------------- ----------------------------------------------------------------
showMsg :: SDoc -> PprStyle -> String showMsg :: SDoc -> PprStyle -> String
#if __GLASGOW_HASKELL__ >= 702 #if __GLASGOW_HASKELL__ >= 702
showMsg d stl = map toNull $ renderWithStyle d stl showMsg d stl = map toNull . renderWithStyle d $ stl
#else #else
showMsg d stl = map toNull . Pretty.showDocWith PageMode $ d stl showMsg d stl = map toNull . Pretty.showDocWith PageMode $ d stl
#endif #endif