Sasha Bogicevic pushed to branch wip/21101 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Tc/Errors/Ppr.hs
    ... ... @@ -359,9 +359,15 @@ instance Diagnostic TcRnMessage where
    359 359
           -> mkSimpleDecorated $ text "character literal out of range: '\\" <> char c  <> char '\''
    
    360 360
         TcRnIllegalWildcardsInConstructor con
    
    361 361
           -> mkSimpleDecorated $
    
    362
    -           vcat [ text "Illegal `{..}' notation for constructor" <+> quotes (ppr con)
    
    363
    -                , nest 2 (text "Record wildcards may not be used for constructors with unlabelled fields.")
    
    364
    -                , nest 2 (text "Possible fix: Remove the `{..}' and add a match for each field of the constructor.")
    
    362
    +           vcat [ text "The data constructor"
    
    363
    +                  <+> quotes (ppr con)
    
    364
    +                  <+> text "does not have named record fields, so a pattern match"
    
    365
    +                  <+> quotes (ppr con)
    
    366
    +                  <+> text " { .. } is incorrect."
    
    367
    +                , text "Possible fixes:"
    
    368
    +                , nest 2 (text "* Replace the pattern '" <+> quotes (ppr con) <+> text "'{ .. }' with" <+> quotes (ppr con))
    
    369
    +                , nest 2 (text "* Replace the pattern '" <+> quotes (ppr con) <+> text "'{ .. }' with" <+> quotes (ppr con) <+> text "{}")
    
    370
    +                , nest 4 (text "This version works even if you add/remove fields to " <+> quotes (ppr con) <+> text "later")
    
    365 371
                     ]
    
    366 372
         TcRnIgnoringAnnotations anns
    
    367 373
           -> mkSimpleDecorated $