Simon Jakobi pushed to branch wip/sjakobi/T22637 at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Driver/Errors.hs
    ... ... @@ -16,6 +16,7 @@ import GHC.Utils.Error
    16 16
     import GHC.Utils.Outputable
    
    17 17
     import GHC.Utils.Logger
    
    18 18
     import Data.List.NonEmpty (NonEmpty(..))
    
    19
    +import Data.Maybe (fromMaybe)
    
    19 20
     
    
    20 21
     reportError :: Logger -> NamePprCtx -> DiagOpts -> SrcSpan -> SDoc -> IO ()
    
    21 22
     reportError logger nameContext opts span doc = do
    

  • compiler/GHC/Types/Error.hs
    ... ... @@ -109,7 +109,7 @@ import Data.Bifunctor
    109 109
     import Data.Foldable
    
    110 110
     import Data.List.NonEmpty ( NonEmpty (..) )
    
    111 111
     import qualified Data.List.NonEmpty as NE
    
    112
    -import Data.List ( intercalate, sortBy )
    
    112
    +import Data.List ( intercalate, sort )
    
    113 113
     import Data.Maybe ( mapMaybe, maybeToList )
    
    114 114
     import Data.Typeable ( Typeable )
    
    115 115
     import Numeric.Natural ( Natural )
    
    ... ... @@ -804,7 +804,7 @@ getCaretDiagnostics msg_class spans =
    804 804
       vcat <$> traverse (getSingleCaretDiagnostic msg_class) (dedupSortedRealSpans spans)
    
    805 805
       where
    
    806 806
         dedupSortedRealSpans :: NonEmpty SrcSpan -> [RealSrcSpan]
    
    807
    -    dedupSortedRealSpans = go Nothing . sortBy leftmost_smallest . mapMaybe srcSpanToRealSrcSpan . NE.toList
    
    807
    +    dedupSortedRealSpans = go Nothing . sort . mapMaybe srcSpanToRealSrcSpan . NE.toList
    
    808 808
           where
    
    809 809
             go _ [] = []
    
    810 810
             go prev (span:rest)