Refactor SrcLoc and SrcSpan The "Unhelpful" cases are now in a separate type. This allows us to improve various things, e.g.: * Most of the panic's in SrcLoc are now gone * The Lexer now works with RealSrcSpans rather than SrcSpans, i.e. it knows that it has real locations and thus can assume that the line number etc really exists * Some of the more suspicious cases are no longer necessary, e.g. we no longer need this case in advanceSrcLoc: advanceSrcLoc loc _ = loc -- Better than nothing More improvements can probably be made, e.g. tick locations can probably use RealSrcSpans too.
Implement fuzzy matching for the Finder ..so that you get a more helpful message when you mis-spell a module name in an 'import'. Validates, but not fully tested. Based on Max's patch in Trac #2442, but heavily refactored.
Refactoring and tidyup of HscMain and related things (also fix #1666) While trying to fix #1666 (-Werror aborts too early) I decided to some tidyup in GHC/DriverPipeline/HscMain. - The GhcMonad overloading is gone from DriverPipeline and HscMain now. GhcMonad is now defined in a module of its own, and only used in the top-level GHC layer. DriverPipeline and HscMain use the plain IO monad and take HscEnv as an argument. - WarnLogMonad is gone. printExceptionAndWarnings is now called printException (the old name is deprecated). Session no longer contains warnings. - HscMain has its own little monad that collects warnings, and also plumbs HscEnv around. The idea here is that warnings are collected while we're in HscMain, but on exit from HscMain (any function) we check for warnings and either print them (via log_action, so IDEs can still override the printing), or turn them into an error if -Werror is on. - GhcApiCallbacks is gone, along with GHC.loadWithLogger. Thomas Schilling told me he wasn't using these, and I don't see a good reason to have them. - there's a new pure API to the parser (suggestion from Neil Mitchell): parser :: String -> DynFlags -> FilePath -> Either ErrorMessages (WarningMessages, Located (HsModule RdrName))
Change "OPTIONS" to "OPTIONS_GHC" in error messages; fixes #4327
Add separate functions for querying DynFlag and ExtensionFlag options and remove the temporary DOpt class workaround.
Add support for Haskell98 and Haskell2010 "languages"
Rename "language" varibles etc to "extension", and add --supported-extensions
Handle haddock headers when looking for LANGUAGE/OPTIONS_GHC pragmas
Make mkPState and pragState take their arguments in the same order
Spelling correction for LANGUAGE pragmas
Add the implicit 'import Prelude' in getImports This makes things more consistent, and avoids a strange "Prelude is not loaded" error when there is a Prelude.hs on the search path.
Columns now start at 1, as lines already did Also corrected a couple of line 0's to line 1
Improve error message for malformed LANGUAGE pragma
remove Haddock-lexing/parsing/renaming from GHC
Fix error handling After the fix to #2500, we could get "Failing due to -Werror." but no warnings printed. Now we don't fail in that case.
FIX #2500: Don't log warnings in getHeader
FIX #3153: we lost an EOF sentinel in the event of a lexical error
FIX #3079, dodgy parsing of LANGUAGE pragmas I ended up rewriting this horrible bit of code, using (yikes) lazy I/O to slurp in the source file a chunk at a time. The old code tried to read the file a chunk at a time, but failed with LANGUAGE pragmas because the parser for LANGUAGE has state and the state wasn't being saved between chunks. We're still closing the Handle eagerly, so there shouldn't be any problems here.
Put full ImportDecls in ModSummary instead of just ModuleNames ... and use it to make ghc -M generate correct cross-package dependencies when using package-qualified imports (needed for the new build system). Since we're already parsing the ImportDecl from the source file, there seems no good reason not to keep it in the ModSummary, it might be useful for other things too.
Document exported functions in main/HeaderInfo.