Simon Peyton Jones pushed to branch wip/T26330 at Glasgow Haskell Compiler / GHC

Commits:

13 changed files:

Changes:

  • compiler/GHC/Core/Opt/Simplify/Env.hs
    ... ... @@ -309,7 +309,7 @@ data SimplPhase
    309 309
     
    
    310 310
     instance Outputable SimplPhase where
    
    311 311
       ppr (SimplPhase p) = ppr p
    
    312
    -  ppr (SimplPhaseRange s e) = brackets $ ppr s <> text "..." <> ppr e
    
    312
    +  ppr (SimplPhaseRange s e) = brackets $ ppr s <> ellipsis <> ppr e
    
    313 313
     
    
    314 314
     -- | Is this activation active in this simplifier phase?
    
    315 315
     --
    

  • compiler/GHC/Core/Ppr.hs
    ... ... @@ -175,7 +175,7 @@ pprOptCo co = sdocOption sdocSuppressCoercions $ \case
    175 175
                   False -> parens $ sep [ppr co, dcolon <+> co_type]
    
    176 176
         where
    
    177 177
           co_type = sdocOption sdocSuppressCoercionTypes $ \case
    
    178
    -          True -> text "..."
    
    178
    +          True  -> ellipsis
    
    179 179
               False -> ppr (coercionType co)
    
    180 180
     
    
    181 181
     ppr_id_occ :: (SDoc -> SDoc) -> Id -> SDoc
    

  • compiler/GHC/HsToCore/Errors/Ppr.hs
    ... ... @@ -246,7 +246,7 @@ instance Diagnostic DsMessage where
    246 246
                   <+> text "may fail for the following constructors:")
    
    247 247
                2
    
    248 248
                (hsep $ punctuate comma $
    
    249
    -            map ppr (take maxCons cons) ++ [ text "..." | lengthExceeds cons maxCons ])
    
    249
    +            map ppr (take maxCons cons) ++ [ ellipsis | lengthExceeds cons maxCons ])
    
    250 250
     
    
    251 251
       diagnosticReason = \case
    
    252 252
         DsUnknownMessage m          -> diagnosticReason m
    
    ... ... @@ -338,7 +338,7 @@ badMonadBind elt_ty
    338 338
     -- Print a single clause (for redundant/with-inaccessible-rhs)
    
    339 339
     pprEqn :: HsMatchContextRn -> SDoc -> String -> SDoc
    
    340 340
     pprEqn ctx q txt = pprContext True ctx (text txt) $ \f ->
    
    341
    -  f (q <+> matchSeparator ctx <+> text "...")
    
    341
    +  f (q <+> matchSeparator ctx <+> ellipsis)
    
    342 342
     
    
    343 343
     pprContext :: Bool -> HsMatchContextRn -> SDoc -> ((SDoc -> SDoc) -> SDoc) -> SDoc
    
    344 344
     pprContext singular kind msg rest_of_msg_fun
    
    ... ... @@ -357,5 +357,5 @@ pprContext singular kind msg rest_of_msg_fun
    357 357
     
    
    358 358
     dots :: Int -> [a] -> SDoc
    
    359 359
     dots maxPatterns qs
    
    360
    -    | qs `lengthExceeds` maxPatterns = text "..."
    
    360
    +    | qs `lengthExceeds` maxPatterns = ellipsis
    
    361 361
         | otherwise                      = empty

  • compiler/GHC/HsToCore/Pmc/Ppr.hs
    ... ... @@ -62,7 +62,7 @@ pprRefutableShapes (var, alts)
    62 62
       = var <+> text "is not one of" <+> format_alts alts
    
    63 63
       where
    
    64 64
         format_alts = braces . fsep . punctuate comma . shorten . map ppr_alt
    
    65
    -    shorten (a:b:c:_:_)       = a:b:c:[text "..."]
    
    65
    +    shorten (a:b:c:_:_)       = a:b:c:[ellipsis]
    
    66 66
         shorten xs                = xs
    
    67 67
         ppr_alt (PmAltConLike cl) = ppr cl
    
    68 68
         ppr_alt (PmAltLit lit)    = ppr lit
    

  • compiler/GHC/HsToCore/Pmc/Types.hs
    ... ... @@ -217,7 +217,7 @@ instance Outputable p => Outputable (PmGRHS p) where
    217 217
     
    
    218 218
     instance Outputable p => Outputable (PmPatBind p) where
    
    219 219
       ppr (PmPatBind PmGRHS { pg_grds = grds, pg_rhs = bind }) =
    
    220
    -    ppr bind <+> ppr grds <+> text "=" <+> text "..."
    
    220
    +    ppr bind <+> ppr grds <+> text "=" <+> ellipsis
    
    221 221
     
    
    222 222
     instance Outputable PmEmptyCase where
    
    223 223
       ppr (PmEmptyCase { pe_var = var }) =
    

  • compiler/GHC/Iface/Syntax.hs
    ... ... @@ -941,7 +941,7 @@ ppr_trim xs
    941 941
       where
    
    942 942
         go (Just doc) (_,     so_far) = (False, doc : so_far)
    
    943 943
         go Nothing    (True,  so_far) = (True, so_far)
    
    944
    -    go Nothing    (False, so_far) = (True, text "..." : so_far)
    
    944
    +    go Nothing    (False, so_far) = (True, ellipsis : so_far)
    
    945 945
     
    
    946 946
     isIfaceDataInstance :: IfaceTyConParent -> Bool
    
    947 947
     isIfaceDataInstance IfNoParent = False
    

  • compiler/GHC/Llvm/Ppr.hs
    ... ... @@ -199,10 +199,7 @@ ppLlvmFunctionDecls decs = vcat $ map ppLlvmFunctionDecl decs
    199 199
     -- the function.
    
    200 200
     ppLlvmFunctionDecl :: IsDoc doc => LlvmFunctionDecl -> doc
    
    201 201
     ppLlvmFunctionDecl (LlvmFunctionDecl n l c r varg p a)
    
    202
    -  = let varg' = case varg of
    
    203
    -                      VarArgs | null p    -> text "..."
    
    204
    -                              | otherwise -> text ", ..."
    
    205
    -                      _otherwise          -> text ""
    
    202
    +  = let varg' = ppVarArgsEllipsis varg p
    
    206 203
             align = case a of
    
    207 204
                          Just a' -> text " align" <+> int a'
    
    208 205
                          Nothing -> empty
    

  • compiler/GHC/Llvm/Types.hs
    ... ... @@ -100,15 +100,17 @@ ppLlvmTypeShort t = case t of
    100 100
       LMVector l t -> "v" ++ show l ++ ppLlvmTypeShort t
    
    101 101
       _ -> pprPanic "ppLlvmTypeShort" (ppLlvmType t)
    
    102 102
     
    
    103
    +ppVarArgsEllipsis :: IsLine doc => LlvmParameterListType -> [LlvmParameter] -> doc
    
    104
    +ppVarArgsEllipsis list_type args
    
    105
    +  = case list_type of
    
    106
    +      FixedArgs           -> text ""
    
    107
    +      VarArgs | null args -> text "..."    -- Can't use ellipsis, comma here,
    
    108
    +              | otherwise -> text ", ..."  -- because they aren't methods of IsLine
    
    109
    +
    
    103 110
     ppParams :: IsLine doc => LlvmParameterListType -> [LlvmParameter] -> doc
    
    104 111
     ppParams varg p
    
    105
    -  = let varg' = case varg of
    
    106
    -          VarArgs | null args -> text "..."
    
    107
    -                  | otherwise -> text ", ..."
    
    108
    -          _otherwise          -> text ""
    
    109
    -        -- by default we don't print param attributes
    
    110
    -        args = map fst p
    
    111
    -    in ppCommaJoin ppLlvmType args <> varg'
    
    112
    +  = ppCommaJoin ppLlvmType (map fst p) <> ppVarArgsEllipsis varg p
    
    113
    +
    
    112 114
     {-# SPECIALIZE ppParams :: LlvmParameterListType -> [LlvmParameter] -> SDoc #-}
    
    113 115
     {-# SPECIALIZE ppParams :: LlvmParameterListType -> [LlvmParameter] -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
    
    114 116
     
    

  • compiler/GHC/Runtime/Loader.hs
    ... ... @@ -317,7 +317,7 @@ getHValueSafely interp hsc_env val_name expected_type = do
    317 317
     lessUnsafeCoerce :: Logger -> String -> a -> IO b
    
    318 318
     lessUnsafeCoerce logger context what = do
    
    319 319
         debugTraceMsg logger 3 $
    
    320
    -        (text "Coercing a value in") <+> (text context) <> (text "...")
    
    320
    +        (text "Coercing a value in") <+> text context <> ellipsis
    
    321 321
         output <- evaluate (unsafeCoerce what)
    
    322 322
         debugTraceMsg logger 3 (text "Successfully evaluated coercion")
    
    323 323
         return output
    

  • compiler/GHC/Tc/Errors/Ppr.hs
    ... ... @@ -1399,7 +1399,7 @@ instance Diagnostic TcRnMessage where
    1399 1399
             EmptyCaseForall tvb ->
    
    1400 1400
               vcat [ text "Empty list of alternatives in" <+> pp_ctxt
    
    1401 1401
                    , hang (text "checked against a forall-type:")
    
    1402
    -                      2 (pprForAll [tvb] <+> text "...")
    
    1402
    +                      2 (pprForAll [tvb] <+> ellipsis)
    
    1403 1403
                    ]
    
    1404 1404
             where
    
    1405 1405
               pp_ctxt = case ctxt of
    
    ... ... @@ -1591,7 +1591,7 @@ instance Diagnostic TcRnMessage where
    1591 1591
                   <+> text "may fail for the following constructors:")
    
    1592 1592
                2
    
    1593 1593
                (hsep $ punctuate comma $
    
    1594
    -            map ppr (take maxCons cons) ++ [ text "..." | lengthExceeds cons maxCons ])
    
    1594
    +            map ppr (take maxCons cons) ++ [ ellipsis | lengthExceeds cons maxCons ])
    
    1595 1595
         TcRnBadFieldAnnotation n con reason -> mkSimpleDecorated $
    
    1596 1596
           hang (pprBadFieldAnnotationReason reason)
    
    1597 1597
              2 (text "on the" <+> speakNth n
    
    ... ... @@ -3759,7 +3759,7 @@ derivErrDiagnosticMessage cls cls_tys mb_strat newtype_deriving pprHerald = \cas
    3759 3759
       DerivErrNotWellKinded tc cls_kind _
    
    3760 3760
         -> sep [ hang (text "Cannot derive well-kinded instance of form"
    
    3761 3761
                              <+> quotes (pprClassPred cls cls_tys
    
    3762
    -                                       <+> parens (ppr tc <+> text "...")))
    
    3762
    +                                       <+> parens (ppr tc <+> ellipsis)))
    
    3763 3763
                       2 empty
    
    3764 3764
                , nest 2 (text "Class" <+> quotes (ppr cls)
    
    3765 3765
                              <+> text "expects an argument of kind"
    
    ... ... @@ -6819,7 +6819,7 @@ pprInvalidAssocDefault = \case
    6819 6819
           ppr_eqn :: SDoc
    
    6820 6820
           ppr_eqn =
    
    6821 6821
             quotes (text "type" <+> ppr (mkTyConApp fam_tc pat_tys)
    
    6822
    -                <+> equals <+> text "...")
    
    6822
    +                <+> equals <+> ellipsis)
    
    6823 6823
     
    
    6824 6824
           suggestion :: SDoc
    
    6825 6825
           suggestion = text "The arguments to" <+> quotes (ppr fam_tc)
    

  • compiler/GHC/Types/Hint/Ppr.hs
    ... ... @@ -227,7 +227,7 @@ instance Outputable GhcHint where
    227 227
                    <+> text "pattern synonym, e.g.")
    
    228 228
                 2 (hang (text "pattern" <+> pp_name <+> pp_args <+> larrow
    
    229 229
                          <+> ppr pat <+> text "where")
    
    230
    -                  2 (pp_name <+> pp_args <+> equals <+> text "..."))
    
    230
    +                  2 (pp_name <+> pp_args <+> equals <+> ellipsis))
    
    231 231
              where
    
    232 232
                pp_name = ppr name
    
    233 233
                pp_args = hsep (map ppr args)
    

  • compiler/GHC/Utils/Outputable.hs
    ... ... @@ -46,7 +46,7 @@ module GHC.Utils.Outputable (
    46 46
             arrow, lollipop, larrow, darrow, arrowt, larrowt, arrowtt, larrowtt,
    
    47 47
             lambda,
    
    48 48
             lparen, rparen, lbrack, rbrack, lbrace, rbrace, underscore,
    
    49
    -        blankLine, forAllLit, bullet,
    
    49
    +        blankLine, forAllLit, bullet, ellipsis,
    
    50 50
             ($+$),
    
    51 51
             cat, fcat,
    
    52 52
             hang, hangNotEmpty, punctuate, punctuateFinal,
    
    ... ... @@ -521,7 +521,7 @@ withPprStyle sty d = SDoc $ \ctxt -> runSDoc d ctxt{sdocStyle=sty}
    521 521
     pprDeeper :: SDoc -> SDoc
    
    522 522
     pprDeeper d = SDoc $ \ctx -> case sdocStyle ctx of
    
    523 523
       PprUser q depth c ->
    
    524
    -   let deeper 0 = Pretty.text "..."
    
    524
    +   let deeper 0 = Pretty.ellipsis
    
    525 525
            deeper n = runSDoc d ctx{sdocStyle = PprUser q (PartWay (n-1)) c}
    
    526 526
        in case depth of
    
    527 527
              DefaultDepth -> deeper (sdocDefaultDepth ctx)
    
    ... ... @@ -551,7 +551,7 @@ pprDeeperList f ds
    551 551
     
    
    552 552
     trim :: Int -> [SDoc] -> [SDoc]
    
    553 553
     trim _ []     = []
    
    554
    -trim 0 _      = [text "..."]
    
    554
    +trim 0 _      = [ellipsis]
    
    555 555
     trim n (d:ds) = d : trim (n-1) ds
    
    556 556
     
    
    557 557
     pprSetDepth :: Depth -> SDoc -> SDoc
    
    ... ... @@ -773,7 +773,7 @@ quotes d = sdocOption sdocCanUseUnicode $ \case
    773 773
                | otherwise        -> Pretty.quotes pp_d
    
    774 774
     
    
    775 775
     blankLine, dcolon, arrow, lollipop, larrow, darrow, arrowt, larrowt, arrowtt,
    
    776
    -  larrowtt, lambda :: SDoc
    
    776
    +  larrowtt, lambda, ellipsis :: SDoc
    
    777 777
     
    
    778 778
     blankLine  = docToSDoc Pretty.emptyText
    
    779 779
     dcolon     = unicodeSyntax (char '∷') (text "::")
    
    ... ... @@ -786,6 +786,7 @@ larrowt = unicodeSyntax (char '⤙') (text "-<")
    786 786
     arrowtt    = unicodeSyntax (char '⤜') (text ">>-")
    
    787 787
     larrowtt   = unicodeSyntax (char '⤛') (text "-<<")
    
    788 788
     lambda     = unicodeSyntax (char 'λ') (char '\\')
    
    789
    +ellipsis   = docToSDoc Pretty.ellipsis
    
    789 790
     
    
    790 791
     semi, comma, colon, equals, space, underscore, dot, vbar :: IsLine doc => doc
    
    791 792
     lparen, rparen, lbrack, rbrack, lbrace, rbrace :: IsLine doc => doc
    

  • compiler/GHC/Utils/Ppr.hs
    ... ... @@ -74,7 +74,7 @@ module GHC.Utils.Ppr (
    74 74
             int, integer, float, double, rational, hex,
    
    75 75
     
    
    76 76
             -- ** Simple derived documents
    
    77
    -        semi, comma, colon, space, equals,
    
    77
    +        semi, comma, colon, space, equals, ellipsis,
    
    78 78
             lparen, rparen, lbrack, rbrack, lbrace, rbrace,
    
    79 79
     
    
    80 80
             -- ** Wrapping documents in delimiters
    
    ... ... @@ -424,6 +424,7 @@ lbrack :: Doc -- ^ A '[' character
    424 424
     rbrack :: Doc -- ^ A ']' character
    
    425 425
     lbrace :: Doc -- ^ A '{' character
    
    426 426
     rbrace :: Doc -- ^ A '}' character
    
    427
    +ellipsis :: Doc -- ^ A '...' ellipsis
    
    427 428
     semi   = char ';'
    
    428 429
     comma  = char ','
    
    429 430
     colon  = char ':'
    
    ... ... @@ -435,6 +436,7 @@ lbrack = char '['
    435 436
     rbrack = char ']'
    
    436 437
     lbrace = char '{'
    
    437 438
     rbrace = char '}'
    
    439
    +ellipsis = text "..."
    
    438 440
     
    
    439 441
     spaceText, nlText :: TextDetails
    
    440 442
     spaceText = Chr ' '