Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

10 changed files:

Changes:

  • compiler/GHC/Tc/Errors/Ppr.hs
    ... ... @@ -636,11 +636,6 @@ instance Diagnostic TcRnMessage where
    636 636
            $ formatExportItemError
    
    637 637
                (text "module" <+> ppr mod)
    
    638 638
                "is missing an export list"
    
    639
    -    TcRnExportHiddenComponents export_item
    
    640
    -      -> mkSimpleDecorated
    
    641
    -       $ formatExportItemError
    
    642
    -           (ppr export_item)
    
    643
    -           "attempts to export constructors or class methods that are not visible here"
    
    644 639
         TcRnExportHiddenDefault export_item
    
    645 640
           -> mkSimpleDecorated
    
    646 641
            $ formatExportItemError
    
    ... ... @@ -2231,8 +2226,6 @@ instance Diagnostic TcRnMessage where
    2231 2226
           -> WarningWithFlag Opt_WarnDodgyExports
    
    2232 2227
         TcRnMissingExportList{}
    
    2233 2228
           -> WarningWithFlag Opt_WarnMissingExportList
    
    2234
    -    TcRnExportHiddenComponents{}
    
    2235
    -      -> ErrorWithoutFlag
    
    2236 2229
         TcRnExportHiddenDefault{}
    
    2237 2230
           -> ErrorWithoutFlag
    
    2238 2231
         TcRnDuplicateExport{}
    
    ... ... @@ -2904,8 +2897,6 @@ instance Diagnostic TcRnMessage where
    2904 2897
           -> noHints
    
    2905 2898
         TcRnMissingExportList{}
    
    2906 2899
           -> noHints
    
    2907
    -    TcRnExportHiddenComponents{}
    
    2908
    -      -> noHints
    
    2909 2900
         TcRnExportHiddenDefault{}
    
    2910 2901
           -> noHints
    
    2911 2902
         TcRnDuplicateExport{}
    

  • compiler/GHC/Tc/Errors/Types.hs
    ... ... @@ -1608,15 +1608,6 @@ data TcRnMessage where
    1608 1608
       -}
    
    1609 1609
       TcRnMissingExportList :: ModuleName -> TcRnMessage
    
    1610 1610
     
    
    1611
    -  {-| TcRnExportHiddenComponents is an error that occurs when an export contains
    
    1612
    -      constructor or class methods that are not visible.
    
    1613
    -
    
    1614
    -      Example(s): None
    
    1615
    -
    
    1616
    -     Test cases: None
    
    1617
    -  -}
    
    1618
    -  TcRnExportHiddenComponents :: IE GhcPs -> TcRnMessage
    
    1619
    -
    
    1620 1611
       {-| TcRnExportHiddenDefault is an error that occurs when an export contains
    
    1621 1612
           a class default (with language extension NamedDefaults) that is not visible.
    
    1622 1613
     
    

  • compiler/GHC/Tc/Gen/Export.hs
    ... ... @@ -526,7 +526,7 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod
    526 526
               } (L loc ie@(IEThingAll (warn_txt_ps, ann) l doc))
    
    527 527
             = do mb_gre <- lookupGreAvailRn (ieLWrappedNameWhatLooking l) $ lieWrappedName l
    
    528 528
                  for mb_gre $ \ par -> do
    
    529
    -               all_kids <- lookup_ie_kids_all ie l par
    
    529
    +               all_kids <- lookup_ie_kids_all l par
    
    530 530
                    let name = greName par
    
    531 531
                        all_gres = par : all_kids
    
    532 532
                        all_names = map greName all_gres
    
    ... ... @@ -562,7 +562,7 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod
    562 562
                    wc_kids <-
    
    563 563
                      case wc of
    
    564 564
                        NoIEWildcard -> return []
    
    565
    -                   IEWildcard _ -> lookup_ie_kids_all ie l par
    
    565
    +                   IEWildcard _ -> lookup_ie_kids_all l par
    
    566 566
     
    
    567 567
                    let name = greName par
    
    568 568
                        all_kids = with_kids ++ wc_kids
    
    ... ... @@ -595,20 +595,15 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod
    595 595
              ; kids <- lookupChildrenExport gre child_gres sub_rdrs
    
    596 596
              ; return (unzip kids) }
    
    597 597
     
    
    598
    -    lookup_ie_kids_all :: IE GhcPs -> LIEWrappedName GhcPs -> GlobalRdrElt
    
    598
    +    lookup_ie_kids_all :: LIEWrappedName GhcPs -> GlobalRdrElt
    
    599 599
                       -> RnM [GlobalRdrElt]
    
    600
    -    lookup_ie_kids_all ie (L _loc rdr) gre =
    
    600
    +    lookup_ie_kids_all (L _loc rdr) gre =
    
    601 601
           do { let name = greName gre
    
    602 602
                    gres = findChildren kids_env name
    
    603 603
              -- We only choose level 0 exports when filling in part of an export list implicitly.
    
    604 604
              ; let kids_0 = mapMaybe pickLevelZeroGRE gres
    
    605 605
              ; addUsedKids (ieWrappedName rdr) kids_0
    
    606
    -         ; when (null kids_0) $
    
    607
    -            if isTyConName name
    
    608
    -            then addTcRnDiagnostic (TcRnDodgyExports gre)
    
    609
    -            else -- This occurs when you export T(..), but
    
    610
    -                 -- only import T abstractly, or T is a synonym.
    
    611
    -                 addErr (TcRnExportHiddenComponents ie)
    
    606
    +         ; when (null kids_0) $ addTcRnDiagnostic (TcRnDodgyExports gre)
    
    612 607
              ; return kids_0 }
    
    613 608
     
    
    614 609
         -------------
    

  • compiler/GHC/Types/Error/Codes.hs
    ... ... @@ -505,7 +505,7 @@ type family GhcDiagnosticCode c = n | n -> c where
    505 505
       GhcDiagnosticCode "TcRnExportedModNotImported"                    = 90973
    
    506 506
       GhcDiagnosticCode "TcRnNullExportedModule"                        = 64649
    
    507 507
       GhcDiagnosticCode "TcRnMissingExportList"                         = 85401
    
    508
    -  GhcDiagnosticCode "TcRnExportHiddenComponents"                    = 94558
    
    508
    +  GhcDiagnosticCode "TcRnExportHiddenComponents"                    = Outdated 94558
    
    509 509
       GhcDiagnosticCode "TcRnExportHiddenDefault"                       = 74775
    
    510 510
       GhcDiagnosticCode "TcRnDuplicateExport"                           = 47854
    
    511 511
       GhcDiagnosticCode "TcRnDuplicateNamedDefaultExport"               = 31584
    

  • testsuite/tests/diagnostic-codes/codes.stdout
    ... ... @@ -50,7 +50,6 @@
    50 50
     [GHC-17268] is untested (constructor = TcRnCharLiteralOutOfRange)
    
    51 51
     [GHC-36495] is untested (constructor = TcRnTagToEnumMissingValArg)
    
    52 52
     [GHC-55868] is untested (constructor = TcRnArrowIfThenElsePredDependsOnResultTy)
    
    53
    -[GHC-94558] is untested (constructor = TcRnExportHiddenComponents)
    
    54 53
     [GHC-63055] is untested (constructor = TcRnFieldUpdateInvalidType)
    
    55 54
     [GHC-26133] is untested (constructor = TcRnForeignImportPrimSafeAnn)
    
    56 55
     [GHC-03355] is untested (constructor = TcRnIllegalForeignDeclBackend)
    

  • testsuite/tests/warnings/should_compile/DodgyExports02.hs
    1
    +module DodgyExports02
    
    2
    +  ( Identity(..)   -- type constructor has out-of-scope children
    
    3
    +  , Void(..)       -- type constructor has no children
    
    4
    +  ) where
    
    5
    +
    
    6
    +import Data.Void (Void)
    
    7
    +import Data.Functor.Identity (Identity)

  • testsuite/tests/warnings/should_compile/DodgyExports02.stderr
    1
    +DodgyExports02.hs:2:5: warning: [GHC-75356] [-Wdodgy-exports (in -Wextra)]
    
    2
    +    The export item ‘Identity(..)’ suggests that
    
    3
    +    ‘Identity’ has (in-scope) constructors or record fields,
    
    4
    +                   but it has none
    
    5
    +
    
    6
    +DodgyExports02.hs:3:5: warning: [GHC-75356] [-Wdodgy-exports (in -Wextra)]
    
    7
    +    The export item ‘Void(..)’ suggests that
    
    8
    +    ‘Void’ has (in-scope) constructors or record fields,
    
    9
    +               but it has none
    
    10
    +

  • testsuite/tests/warnings/should_compile/DodgyExports03.hs
    1
    +{-# LANGUAGE ExplicitNamespaces #-}
    
    2
    +
    
    3
    +module DodgyExports03
    
    4
    +  ( data MkR(..)  -- data constructors never have children ('fld' belongs to 'R')
    
    5
    +  ) where
    
    6
    +
    
    7
    +data R = MkR { fld :: Int }

  • testsuite/tests/warnings/should_compile/DodgyExports03.stderr
    1
    +DodgyExports03.hs:4:5: warning: [GHC-75356] [-Wdodgy-exports (in -Wextra)]
    
    2
    +    The export item ‘MkR(..)’ suggests that
    
    3
    +    ‘MkR’ has children, but it is not a type constructor or a class
    
    4
    +

  • testsuite/tests/warnings/should_compile/all.T
    ... ... @@ -54,6 +54,8 @@ test('T19564d', normal, compile, [''])
    54 54
     # Also, suppress uniques as one of the warnings is unstable in CI, otherwise.
    
    55 55
     test('T19296', normal, compile, ['-fdiagnostics-show-caret -Wredundant-constraints -dsuppress-uniques'])
    
    56 56
     test('DodgyExports01', normal, compile, ['-Wdodgy-exports'])
    
    57
    +test('DodgyExports02', normal, compile, ['-Wdodgy-exports'])
    
    58
    +test('DodgyExports03', normal, compile, ['-Wdodgy-exports'])
    
    57 59
     test('DerivingTypeable', normal, compile, ['-Wderiving-typeable'])
    
    58 60
     test('T18862a', normal, compile, [''])
    
    59 61
     test('T18862b', normal, compile, [''])