[Git][ghc/ghc][wip/jade/ast] simplified design based on Simon's suggestions. Let see if it passes the tests...

Hassan Al-Awwadi (@hassan.awwadi) gitlab at gitlab.haskell.org
Fri Oct 4 14:38:32 UTC 2024



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


Commits:
fa5fc587 by Hassan Al-Awwadi at 2024-10-04T16:38:03+02:00
simplified design based on Simon's suggestions. Let see if it passes the tests or if I broke something.

- - - - -


13 changed files:

- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/ThToHs.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/Language/Haskell/Syntax/Pat.hs
- compiler/Language/Haskell/Syntax/Type.hs
- utils/check-exact/ExactPrint.hs


Changes:

=====================================
compiler/GHC/Hs/Instances.hs
=====================================
@@ -557,11 +557,6 @@ deriving instance Data (ConDeclField GhcTc)
 deriving instance Data (FieldOcc GhcPs)
 deriving instance Data (FieldOcc GhcRn)
 deriving instance Data (FieldOcc GhcTc)
-deriving instance Data AmbiguousFieldOcc
-
-deriving instance Data (UpdFieldOcc GhcPs)
-deriving instance Data (UpdFieldOcc GhcRn)
-deriving instance Data (UpdFieldOcc GhcTc)
 
 -- deriving instance (DataId name) => Data (ImportDecl name)
 deriving instance Data (ImportDecl GhcPs)


=====================================
compiler/GHC/Hs/Type.hs
=====================================
@@ -59,12 +59,8 @@ module GHC.Hs.Type (
         ConDeclField(..), LConDeclField, pprConDeclFields,
 
         HsConDetails(..), noTypeArgs,
-        UpdFieldOcc(..), LUpdFieldOcc, mkUpdFieldOcc,
-        updFieldOccRdrName, updFieldOccLRdrName,
         FieldOcc(..), LFieldOcc, mkFieldOcc,
         fieldOccRdrName, fieldOccLRdrName,
-        AmbiguousFieldOcc(..),
-        ambiguousFieldOccRdrName,
 
         OpName(..),
 
@@ -1088,7 +1084,7 @@ also forbids them in types involved with `deriving`:
 *                                                                      *
 ************************************************************************
 
-Note [Lifecycle of FieldOcc/UpdFieldOcc]
+Note [Ambiguous FieldOcc in record updates]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 When renaming a "record field update" (`some_record{ field = expr }`), the field
 occurrence may be ambiguous if there are multiple record types with that same
@@ -1096,64 +1092,22 @@ field label in scope. Instead of failing, we may attempt to do type-directed
 disambiguation: if we typecheck the record field update, we can disambiguate
 the `field` based on the record and field type.
 
-In practice, this means an identifier of an update field occurrence
-(`UpdFieldOcc`) may have to go straight from `RdrName` to `Id`, since field
+In practice, this means an identifier of a field occurrence
+(`FieldOcc`) may have to go straight from `RdrName` to `Id`, since field
 ambiguity makes it impossible to construct a `Name` for the field.
 
 Since type-directed disambiguation is a GHC property rather than a property of
-the GHC-Haskell AST, we still parametrise an `UpdFieldOcc` occurrence by `IdP p`,
-but introduce a constructor `AmbiguousFieldOcc` in the `XXUpdFieldOcc` extension point.
-That is:
-
-    * `AmbiguousFieldOcc @GhcRn :: RdrName -> UpdFieldOcc`
-    * `UpdFieldOcc @GhcRn :: Name -> UpdFieldOcc`
-
-If the update field occurrence is ambiguous, the renamer will construct it with
-`AmbiguousFieldOcc`. Otherwise, it'll use `UpdFieldOcc` -- an unambiguous
-update field occurrence.
-
-In @GhcTc the `UpdFieldOcc` extension point is "deleted" since all field
-occurrences after type checking must be unambiguous.
-
-A `FieldOcc` is a field occurrence that /does not/ occur in a record update, c.f. `UpdFieldOcc`.
-Non-update field occurrences are always unambiguous.
-
-The lifecycle of an UpdFieldOcc is as follows
-* GhcPs:
-  - UpdFieldOcc noExtField (FieldOcc GhcPs)
-  - XUpdFieldOcc DataConCantHappen
-* GhcRn:
-  - UpdFieldOcc noExtField (FieldOCc GhcRn)
-  - XUpdFieldOcc /AmbiguousFieldOcc/
-* GhcTc:
-  - UpdFieldOcc noExtField (FieldOCc GhcRn)
-  - XUpdFieldOcc DataConCantHappen
-
-The lifecycle of a FieldOcc is more straightforward:
-* GhcPs: FieldOcc noExtField RdrName
-* GhcRn: FieldOcc RdrName    Name
-* GhcTc: FieldOcc RdrName    Id
+the GHC-Haskell AST, we still parameterise a `FieldOcc` occurrence by `IdP p`,
+but in the case of the ambiguity we do the unthinkable and insert a mkUnboundName
+in the name. Very bad, yes, but since type-directed disambiguation is on the way
+out (see ticket #18966), we consider this acceptable for now.
+
+see also Wrinkle [Disambiguating fields] and note [Type-directed record disambiguation]
 
 NB: FieldOcc preserves the RdrName throughout its lifecycle for
 exact printing purposes.
 -}
 
--- | Ambiguous Field Occurrence
---
--- Represents an *occurrence* of a field that is definiely
--- ambiguous after the renamer, with the ambiguity resolved by the
--- typechecker. We always store the 'RdrName' that the user
--- originally wrote, and store the selector function after the typechecker (for
--- ambiguous occurrences).
---
--- Unambiguous field occurrences should be stored in the proper
--- UpdFieldOcc datacon of UpdFieldOcc.
---
--- See Note [HsRecField and HsRecUpdField] in "GHC.Hs.Pat".
--- See Note [Located RdrNames] in "GHC.Hs.Expr".
-newtype AmbiguousFieldOcc
-  = Ambiguous (LocatedN RdrName)
-
 type instance XCFieldOcc GhcPs = NoExtField -- RdrName is stored in the proper IdP field
 type instance XCFieldOcc GhcRn = RdrName
 type instance XCFieldOcc GhcTc = RdrName
@@ -1162,33 +1116,11 @@ type instance XXFieldOcc GhcPs = DataConCantHappen
 type instance XXFieldOcc GhcRn = DataConCantHappen
 type instance XXFieldOcc GhcTc = DataConCantHappen
 
-type instance XCUpdFieldOcc GhcPs = NoExtField
-type instance XCUpdFieldOcc GhcRn = NoExtField
-type instance XCUpdFieldOcc GhcTc = NoExtField
-
-type instance XXUpdFieldOcc GhcPs = DataConCantHappen
-type instance XXUpdFieldOcc GhcRn = AmbiguousFieldOcc
-type instance XXUpdFieldOcc GhcTc = DataConCantHappen
-
 --------------------------------------------------------------------------------
 
-mkUpdFieldOcc :: LocatedN RdrName -> UpdFieldOcc GhcPs
-mkUpdFieldOcc rdr@(L l _) = UpdFieldOcc noExtField (L (l2l l) $ mkFieldOcc rdr)
-
 mkFieldOcc :: LocatedN RdrName -> FieldOcc GhcPs
 mkFieldOcc rdr = FieldOcc noExtField rdr
 
-updFieldOccRdrName :: forall p. IsPass p => UpdFieldOcc (GhcPass p) -> RdrName
-updFieldOccRdrName = unLoc . updFieldOccLRdrName
-
-updFieldOccLRdrName :: forall p. IsPass p => UpdFieldOcc (GhcPass p) -> LocatedN RdrName
-updFieldOccLRdrName (UpdFieldOcc _ (L _ fo)) = fieldOccLRdrName fo
-updFieldOccLRdrName (XUpdFieldOcc xfo) = case ghcPass @p of
-  GhcRn -> case xfo of
-    Ambiguous l -> l
-  GhcPs -> dataConCantHappen xfo
-  GhcTc -> dataConCantHappen xfo
-
 fieldOccRdrName :: forall p. IsPass p => FieldOcc (GhcPass p) -> RdrName
 fieldOccRdrName fo = case ghcPass @p of
   GhcPs -> unLoc $ foLabel fo
@@ -1206,19 +1138,6 @@ fieldOccLRdrName fo = case ghcPass @p of
     let (L l _) = foLabel fo
      in L l (foExt fo)
 
-instance Outputable AmbiguousFieldOcc where
-  ppr = ppr . ambiguousFieldOccRdrName
-
-instance OutputableBndr AmbiguousFieldOcc where
-  pprInfixOcc  = pprInfixOcc . ambiguousFieldOccRdrName
-  pprPrefixOcc = pprPrefixOcc . ambiguousFieldOccRdrName
-
-instance OutputableBndr (Located AmbiguousFieldOcc) where
-  pprInfixOcc  = pprInfixOcc . unLoc
-  pprPrefixOcc = pprPrefixOcc . unLoc
-
-ambiguousFieldOccRdrName :: AmbiguousFieldOcc -> RdrName
-ambiguousFieldOccRdrName (Ambiguous rdr) = unLoc rdr
 
 {-
 ************************************************************************
@@ -1359,12 +1278,6 @@ instance (OutputableBndrId pass) => OutputableBndr (GenLocated SrcSpan (FieldOcc
   pprInfixOcc  = pprInfixOcc . unLoc
   pprPrefixOcc = pprPrefixOcc . unLoc
 
-instance (IsPass p) => Outputable (UpdFieldOcc (GhcPass p))where
-  ppr = ppr . updFieldOccRdrName
-
-instance (IsPass p) => OutputableBndr (UpdFieldOcc (GhcPass p)) where
-  pprInfixOcc  = pprInfixOcc . updFieldOccRdrName
-  pprPrefixOcc = pprPrefixOcc . updFieldOccRdrName
 
 
 ppr_tylit :: (HsTyLit (GhcPass p)) -> SDoc
@@ -1663,5 +1576,3 @@ type instance Anno HsIPName = EpAnnCO
 type instance Anno (ConDeclField (GhcPass p)) = SrcSpanAnnA
 
 type instance Anno (FieldOcc (GhcPass p)) = SrcSpanAnnA
-type instance Anno AmbiguousFieldOcc = SrcSpanAnnA
-type instance Anno (UpdFieldOcc (GhcPass p)) = SrcSpanAnnA


=====================================
compiler/GHC/HsToCore/Quote.hs
=====================================
@@ -1823,12 +1823,11 @@ repUpdFields = repListM fieldExpTyConName rep_fld
   where
     rep_fld :: LHsRecUpdField GhcRn GhcRn -> MetaM (Core (M TH.FieldExp))
     rep_fld (L l fld) = case unLoc (hfbLHS fld) of
-      UpdFieldOcc _ (L _ (FieldOcc _ (L _ sel_name))) ->
+       (FieldOcc _ (L _ sel_name)) ->
           do  { fn <- lookupLOcc (L l sel_name)
               ; e  <- repLE (hfbRHS fld)
               ; repFieldExp fn e
               }
-      (XUpdFieldOcc _)                                -> notHandled (ThAmbiguousRecordUpdates fld)
 
 
 


=====================================
compiler/GHC/Iface/Ext/Ast.hs
=====================================
@@ -828,7 +828,6 @@ class ( HiePass (NoGhcTcPass p)
       , Data (Stmt  (GhcPass p) (LocatedA (HsCmd  (GhcPass p))))
       , Data (HsExpr (GhcPass p))
       , Data (HsCmd  (GhcPass p))
-      , Data AmbiguousFieldOcc
       , Data (HsCmdTop (GhcPass p))
       , Data (GRHS (GhcPass p) (LocatedA (HsCmd (GhcPass p))))
       , Data (HsUntypedSplice (GhcPass p))
@@ -1509,10 +1508,6 @@ instance ( ToHie (RFContext label)
       , toHie expr
       ]
 
-instance HiePass p => ToHie (RFContext (LocatedA (UpdFieldOcc (GhcPass p)))) where
-  toHie (RFC c rhs (L nspan (UpdFieldOcc _ (L _ fo)))) = concatM
-    [toHie (RFC c rhs (L nspan fo))]
-  toHie (RFC _ _ (L _ (XUpdFieldOcc _))) = concatM []
 instance HiePass p => ToHie (RFContext (LocatedA (FieldOcc (GhcPass p)))) where
   toHie (RFC c rhs (L nspan f)) = concatM $
     case hiePass @p of


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -2912,7 +2912,7 @@ mkRdrRecordUpd overloaded_on exp@(L loc _) fbinds anns = do
     True -> do
       let qualifiedFields =
             [ L l lbl | L _ (HsFieldBind _ (L l lbl) _ _) <- fs'
-                      , isQual . updFieldOccRdrName $ lbl
+                      , isQual . fieldOccRdrName $ lbl
             ]
       case qualifiedFields of
           qf:_ -> addFatalError $ mkPlainErrorMsgEnvelope (getLocA qf) $
@@ -2958,7 +2958,7 @@ mk_rec_fields fs (Just s)  = HsRecFields { rec_ext = noExtField, rec_flds = fs
 
 mk_rec_upd_field :: HsRecField GhcPs (LHsExpr GhcPs) -> HsRecUpdField GhcPs GhcPs
 mk_rec_upd_field (HsFieldBind noAnn (L loc (FieldOcc _ rdr)) arg pun)
-  = HsFieldBind noAnn (L loc $ UpdFieldOcc noExtField (L loc (FieldOcc noExtField rdr))) arg pun
+  = HsFieldBind noAnn (L loc (FieldOcc noExtField rdr)) arg pun
 
 mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation
                -> InlinePragma


=====================================
compiler/GHC/Rename/Env.hs
=====================================
@@ -1526,7 +1526,7 @@ lookupGlobalOccRn_overloaded rdr_name =
               return (Just gre) }
 
 getFieldUpdLbl :: IsPass p => LHsRecUpdField (GhcPass p) q -> LocatedN RdrName
-getFieldUpdLbl = updFieldOccLRdrName . unLoc . hfbLHS . unLoc
+getFieldUpdLbl = fieldOccLRdrName . unLoc . hfbLHS . unLoc
 
 -- | Returns all possible collections of field labels for the given
 -- record update.
@@ -1623,7 +1623,7 @@ lookupRecUpdFields flds
 getUpdFieldLbls :: forall p q. IsPass p
                 => [LHsRecUpdField (GhcPass p) q] -> [RdrName]
 getUpdFieldLbls
-  = map $ updFieldOccRdrName
+  = map $ fieldOccRdrName
         . unXRec @(GhcPass p)
         . hfbLHS
         . unXRec @(GhcPass p)


=====================================
compiler/GHC/Rename/Pat.hs
=====================================
@@ -890,7 +890,7 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot })
               -> Maybe Name -- The constructor (Nothing for an
                                 --    out of scope constructor)
               -> [LHsRecField GhcRn (LocatedA arg)] -- Explicit fields
-              -> RnM ([LHsRecField GhcRn (LocatedA arg)])   -- Field Labels we need to fill in
+              -> RnM [LHsRecField GhcRn (LocatedA arg)]   -- Field Labels we need to fill in
     rn_dotdot (Just (L loc_e (RecFieldsDotDot n))) (Just con) flds -- ".." on record construction / pat match
       | not (isUnboundName con) -- This test is because if the constructor
                                 -- isn't in scope the constructor lookup will add
@@ -1018,7 +1018,7 @@ rnHsRecUpdFields flds
               -> RnM ([LHsRecUpdField GhcRn GhcRn], FreeVars)
       rn_flds _ _ [] = return ([], emptyFVs)
       rn_flds pun_ok mb_unambig_lbls
-              ((L l (HsFieldBind { hfbLHS = L loc (UpdFieldOcc _ (L _ (FieldOcc _ f)))
+              ((L l (HsFieldBind { hfbLHS = L loc (FieldOcc _ f)
                                  , hfbRHS = arg
                                  , hfbPun = pun })):flds)
         = do { let lbl = unLoc f
@@ -1030,12 +1030,15 @@ rnHsRecUpdFields flds
                                ; return (L (l2l loc) (HsVar noExtField (L (l2l loc) arg_rdr))) }
                        else return arg
              ; (arg'', fvs) <- rnLExpr arg'
-             ; let lbl' :: UpdFieldOcc GhcRn
+             ; let lbl' :: FieldOcc GhcRn
                    lbl' = case mb_unambig_lbls of
                             { Just (fl:_) ->
                                 let sel_name = flSelector fl
-                                in UpdFieldOcc noExtField (L (l2l loc) (FieldOcc lbl (L (l2l loc) sel_name)))
-                            ; _ -> XUpdFieldOcc (Ambiguous (L (l2l loc) lbl)) }
+                                in FieldOcc lbl (L (l2l loc) sel_name)
+                                -- We have one last chance to be disambiguated during type checking.
+                                -- At least, until type-directed disambiguation stops being supported.
+                                -- see note [Ambiguous FieldOcc in record updates] for more info.
+                            ; _ -> FieldOcc lbl (L (l2l loc) (mkUnboundName $ rdrNameOcc lbl)) }
                    fld' :: LHsRecUpdField GhcRn GhcRn
                    fld' = L l (HsFieldBind { hfbAnn = noAnn
                                            , hfbLHS = L (l2l loc) lbl'
@@ -1043,8 +1046,6 @@ rnHsRecUpdFields flds
                                            , hfbPun = pun })
              ; (flds', fvs') <- rn_flds pun_ok (tail <$> mb_unambig_lbls) flds
              ; return (fld' : flds', fvs `plusFV` fvs') }
-      rn_flds _ _ ((L _ (HsFieldBind { hfbLHS = L _ (XUpdFieldOcc impossible ) })):_)
-        = dataConCantHappen impossible
 
 getFieldIds :: [LHsRecField GhcRn arg] -> [Name]
 getFieldIds flds = map (hsRecFieldSel . unLoc) flds


=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -1298,12 +1298,10 @@ expandRecordUpd record_expr possible_parents rbnds res_ty
        -- See Note [Disambiguating record updates] in GHC.Rename.Pat.
        ; (cons, rbinds)
            <- disambiguateRecordBinds record_expr record_rho possible_parents rbnds res_ty
-       ; let upd_flds      = map (unLoc . hfbLHS . unLoc) rbinds
-             -- upd_flds has type 'UpdFieldOcc GhcTc' so ufoField is not partial here.
-             sel_ids       = map (unLoc . foLabel . unLoc . ufoField) upd_flds
+       ; let sel_ids       = map (unLoc . foLabel . unLoc . hfbLHS . unLoc) rbinds
              upd_fld_names = map idName sel_ids
              relevant_cons = nonDetEltsUniqSet cons
-             relevant_con = head relevant_cons
+             relevant_con  = head relevant_cons
 
       -- STEP 2: expand the record update.
       --
@@ -1583,7 +1581,7 @@ disambiguateRecordBinds record_expr record_rho possible_parents rbnds res_ty
                 -> TcM (LHsRecUpdField GhcTc GhcRn)
     lookupField fld_gre (L l upd)
       = do { let L loc af = hfbLHS upd
-                 lbl      = updFieldOccRdrName af
+                 lbl      = fieldOccRdrName af
                  mb_gre   = pickGREs lbl [fld_gre]
                       -- NB: this GRE can be 'Nothing' when in GHCi.
                       -- See test T10439.
@@ -1595,7 +1593,7 @@ disambiguateRecordBinds record_expr record_rho possible_parents rbnds res_ty
            ; sel <- tcLookupId (greName fld_gre)
            ; return $ L l HsFieldBind
                { hfbAnn = hfbAnn upd
-               , hfbLHS = L (l2l loc) (UpdFieldOcc noExtField (L (l2l loc) $ FieldOcc lbl  (L (l2l loc) sel)))
+               , hfbLHS = L (l2l loc) (FieldOcc lbl  (L (l2l loc) sel))
                , hfbRHS = hfbRHS upd
                , hfbPun = hfbPun upd
                } }


=====================================
compiler/GHC/ThToHs.hs
=====================================
@@ -1159,7 +1159,7 @@ cvtl e = wrapLA (cvt e)
                               ; return $ mkRdrRecordCon c' (HsRecFields noExtField flds' Nothing) noAnn }
     cvt (RecUpdE e flds) = do { e' <- cvtl e
                               ; flds'
-                                  <- mapM (cvtFld (wrapParLA mkUpdFieldOcc))
+                                  <- mapM (cvtFld (wrapParLA mkFieldOcc))
                                            flds
                               ; return $ RecordUpd noAnn e' $
                                          RegularRecUpdFields


=====================================
compiler/Language/Haskell/Syntax/Extension.hs
=====================================
@@ -685,9 +685,6 @@ type family XXConDeclField x
 
 -- ---------------------------------------------------------------------
 -- FieldOcc type families
-type family XCUpdFieldOcc x
-type family XXUpdFieldOcc x
-
 type family XCFieldOcc x
 type family XXFieldOcc x
 


=====================================
compiler/Language/Haskell/Syntax/Pat.hs
=====================================
@@ -319,14 +319,14 @@ type LHsFieldBind p id arg = XRec p (HsFieldBind id arg)
 -- | Located Haskell Record Field
 type LHsRecField  p arg = XRec p (HsRecField  p arg)
 
--- | Located Haskell Record Update Field
-type LHsRecUpdField p q = XRec p (HsRecUpdField p q)
-
 -- | Haskell Record Field
 type HsRecField p arg   = HsFieldBind (LFieldOcc p) arg
 
+-- | Located Haskell Record Update Field
+type LHsRecUpdField p q = XRec p (HsRecUpdField p q)
+
 -- | Haskell Record Update Field
-type HsRecUpdField p q  = HsFieldBind (LUpdFieldOcc p) (LHsExpr q)
+type HsRecUpdField p q  = HsFieldBind (LFieldOcc p) (LHsExpr q)
 
 -- | Haskell Field Binding
 --


=====================================
compiler/Language/Haskell/Syntax/Type.hs
=====================================
@@ -54,7 +54,6 @@ module Language.Haskell.Syntax.Type (
 
         HsConDetails(..), noTypeArgs,
 
-        UpdFieldOcc(..), LUpdFieldOcc,
         FieldOcc(..), LFieldOcc,
 
         mapHsOuterImplicit,
@@ -1352,21 +1351,6 @@ The SrcSpan is the span of the original HsPar
 *                                                                      *
 ************************************************************************
 -}
--- | Located Update Field Occurrence
-type LUpdFieldOcc pass = XRec pass (UpdFieldOcc pass)
-
--- | An update field occurrence is a field occurrence that
--- occurs in an update position (such as @x{field=...}@).
---
--- We differentiate between the two since there may be additional information concerning the update field.
--- In particular, in GHC, an update field occurrence *may* be ambiguous, unlike other field occurrences.
--- See Note [Lifecycle of an UpdFieldOcc]
-data UpdFieldOcc pass
-  = UpdFieldOcc {
-    ufoExt   :: XCUpdFieldOcc pass,
-    ufoField :: LFieldOcc pass
-  }
-  | XUpdFieldOcc (XXUpdFieldOcc pass)
 
 -- | Located Field Occurrence
 type LFieldOcc pass = XRec pass (FieldOcc pass)
@@ -1381,6 +1365,11 @@ type LFieldOcc pass = XRec pass (FieldOcc pass)
 -- We store both the 'RdrName' the user originally wrote, and after
 -- the renamer we use the extension field to store the selector
 -- function.
+--
+-- There is a wrinkle in that update field occurances are sometimes
+-- ambiguous during the rename stage. See note
+-- [Ambiguous FieldOcc in record updates] to see how we currently
+-- handle this.
 data FieldOcc pass
   = FieldOcc {
         foExt :: XCFieldOcc pass


=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -3505,22 +3505,6 @@ instance (ExactPrint body)
 
 -- ---------------------------------------------------------------------
 
-instance (ExactPrint (LocatedA body))
-    => ExactPrint (HsFieldBind (LocatedA (UpdFieldOcc GhcPs)) (LocatedA body)) where
-  getAnnotationEntry _ = NoEntryVal
-  setAnnotationAnchor a _ _ _ = a
-
-  exact (HsFieldBind an f arg isPun) = do
-    debugM $ "HsRecUpdField"
-    f' <- markAnnotated f
-    an0 <- if isPun then return an
-             else markEpAnnL an lidl AnnEqual
-    arg' <- if isPun
-              then return arg
-              else markAnnotated arg
-    return (HsFieldBind an0 f' arg' isPun)
-
--- ---------------------------------------------------------------------
 instance ExactPrint (LHsRecUpdFields GhcPs) where
   getAnnotationEntry = const NoEntryVal
   setAnnotationAnchor a _ _ _ = a
@@ -4591,13 +4575,6 @@ instance ExactPrint (FieldOcc GhcPs) where
 
 -- ---------------------------------------------------------------------
 
-instance ExactPrint (UpdFieldOcc GhcPs) where
-  getAnnotationEntry = const NoEntryVal
-  setAnnotationAnchor a _ _ _ = a
-  exact f@(UpdFieldOcc _ n)       = markAnnotated n >> return f
-  exact (XUpdFieldOcc impossible) = dataConCantHappen impossible
--- ---------------------------------------------------------------------
-
 instance (ExactPrint a) => ExactPrint (HsScaled GhcPs a) where
   getAnnotationEntry = const NoEntryVal
   setAnnotationAnchor a _ _ _ = a



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fa5fc5871229d011f56a0606afa6dc1123875716
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/20241004/bec95d6e/attachment-0001.html>


More information about the ghc-commits mailing list