[Git][ghc/ghc][wip/jade/ast] eleminated outdated comments and use dataConCantHappen

Hassan Al-Awwadi (@hassan.awwadi) gitlab at gitlab.haskell.org
Wed Sep 25 16:38:33 UTC 2024



Hassan Al-Awwadi pushed to branch wip/jade/ast at Glasgow Haskell Compiler / GHC


Commits:
65eb22cb by Hassan Al-Awwadi at 2024-09-25T18:37:45+02:00
eleminated outdated comments and use dataConCantHappen

- - - - -


3 changed files:

- compiler/GHC/Hs/Type.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Pat.hs


Changes:

=====================================
compiler/GHC/Hs/Type.hs
=====================================
@@ -1115,10 +1115,8 @@ updFieldOccLRdrName (UpdFieldOcc _ (L _ fo)) = fieldOccLRdrName fo
 updFieldOccLRdrName (XUpdFieldOcc xfo) = case ghcPass @p of
   GhcRn -> case xfo of
     Ambiguous l -> l
-  -- Are these cases required? I don't get a hint that they aren't so
-  -- they are included for now.
-  GhcPs -> case xfo of
-  GhcTc -> case xfo of
+  GhcPs -> dataConCantHappen xfo
+  GhcTc -> dataConCantHappen xfo
 
 fieldOccRdrName :: forall p. IsPass p => FieldOcc (GhcPass p) -> RdrName
 fieldOccRdrName fo = case ghcPass @p of


=====================================
compiler/GHC/Rename/Bind.hs
=====================================
@@ -824,9 +824,7 @@ rnPatSynBind sig_fn bind@(PSB { psb_id = L l name
                           , psb_ext = fvs' }
               selector_names = case details' of
                                  RecCon names ->
-                                  -- I don't actually know if its fine or not
-                                  -- that foLabel is partial.
-                                  map (unLoc . foLabel . recordPatSynField) names
+                                      map (unLoc . foLabel . recordPatSynField) names
                                  _ -> []
 
         ; fvs' `seq` -- See Note [Free-variable space leak]


=====================================
compiler/GHC/Rename/Pat.hs
=====================================
@@ -1043,10 +1043,8 @@ rnHsRecUpdFields flds
                                            , hfbPun = pun })
              ; (flds', fvs') <- rn_flds pun_ok (tail <$> mb_unambig_lbls) flds
              ; return (fld' : flds', fvs `plusFV` fvs') }
-      -- I have been told this datacon isn't necessary and yet my ghc gets mad at me
-      -- when I don't add it.
       rn_flds _ _ ((L _ (HsFieldBind { hfbLHS = L _ (XUpdFieldOcc impossible ) })):_)
-        = case impossible of
+        = dataConCantHappen impossible
 
 getFieldIds :: [LHsRecField GhcRn arg] -> [Name]
 getFieldIds flds = map (hsRecFieldSel . unLoc) flds



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/65eb22cb743abeb365893b9f871d12ce60512db7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/65eb22cb743abeb365893b9f871d12ce60512db7
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240925/b656997a/attachment-0001.html>


More information about the ghc-commits mailing list