[Git][ghc/ghc][wip/expand-do] - kill HsExpanded and HsExpansion, its now XXExprGhcRn

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Mon Oct 16 15:16:59 UTC 2023



Apoorv Ingle pushed to branch wip/expand-do at Glasgow Haskell Compiler / GHC


Commits:
e8bdbd78 by Apoorv Ingle at 2023-10-16T09:54:15-05:00
- kill HsExpanded and HsExpansion, its now XXExprGhcRn

- - - - -


18 changed files:

- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Do.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Types/LclEnv.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Types/Basic.hs
- compiler/Language/Haskell/Syntax/Expr.hs


Changes:

=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -440,21 +440,21 @@ tupArgPresent (Missing {}) = False
 type instance XXExpr GhcPs = DataConCantHappen
 type instance XXExpr GhcRn = XXExprGhcRn
 type instance XXExpr GhcTc = XXExprGhcTc
--- HsExpansion: see Note [Rebindable syntax and HsExpansion] below
+-- XXExprGhcRn: see Note [Rebindable syntax and XXExprGhcRn] below
 
 
 {- *********************************************************************
 *                                                                      *
-              Generating code for HsExpanded
+              Generating code for ExpandedThingRn
       See Note [Handling overloaded and rebindable constructs]
 *                                                                      *
 ********************************************************************* -}
 
 -- | The different source constructs that we use to instantiate the "original" field
---   in an `HsExpansion original expansion`
+--   in an `XXExprGhcRn original expansion`
 data HsThingRn = OrigExpr (HsExpr GhcRn)
-               | OrigStmt (ExprLStmt GhcRn) -- TODO see if we can get rid of the L here
-               | OrigPat  (LPat GhcRn)      -- TODO see if we can get rid of the L here
+               | OrigStmt (ExprLStmt GhcRn)
+               | OrigPat  (LPat GhcRn)
 
 isHsThingRnExpr, isHsThingRnStmt, isHsThingRnPat :: HsThingRn -> Bool
 isHsThingRnExpr (OrigExpr{}) = True
@@ -467,13 +467,13 @@ isHsThingRnPat (OrigPat{}) = True
 isHsThingRnPat _ = False
 
 data XXExprGhcRn
-  = ExpandedThingRn { xrn_orig :: HsThingRn           -- The original source thing
+  = ExpandedThingRn { xrn_orig     :: HsThingRn       -- The original source thing
                     , xrn_expanded :: HsExpr GhcRn }  -- The compiler generated expanded thing
 
   | PopErrCtxt                                     -- A hint for typechecker to pop
     {-# UNPACK #-} !(LHsExpr GhcRn)                -- the top of the error context stack
                                                    -- Does not presist post renaming phase
-                                                   -- See Part 3. of Note [Expanding HsDo with HsExpansion]
+                                                   -- See Part 3. of Note [Expanding HsDo with XXExprGhcRn]
                                                    -- in `GHC.Tc.Gen.Do`
 
 
@@ -491,7 +491,7 @@ mkPopErrCtxtExprAt loc a = L loc $ mkPopErrCtxtExpr a
 mkExpandedExpr
   :: HsExpr GhcRn         -- ^ source expression
   -> HsExpr GhcRn         -- ^ expanded expression
-  -> HsExpr GhcRn         -- ^ suitably wrapped 'HsExpansion'
+  -> HsExpr GhcRn         -- ^ suitably wrapped 'XXExprGhcRn'
 mkExpandedExpr oExpr eExpr = XExpr (ExpandedThingRn (OrigExpr oExpr) eExpr)
 
 -- | Build an expression using the extension constructor `XExpr`,
@@ -500,13 +500,13 @@ mkExpandedExpr oExpr eExpr = XExpr (ExpandedThingRn (OrigExpr oExpr) eExpr)
 mkExpandedStmt
   :: ExprLStmt GhcRn      -- ^ source statement
   -> HsExpr GhcRn         -- ^ expanded expression
-  -> HsExpr GhcRn         -- ^ suitably wrapped 'HsExpansion'
+  -> HsExpr GhcRn         -- ^ suitably wrapped 'XXExprGhcRn'
 mkExpandedStmt oStmt eExpr = XExpr (ExpandedThingRn (OrigStmt oStmt) eExpr)
 
 mkExpandedPatRn
   :: LPat   GhcRn      -- ^ source pattern
   -> HsExpr GhcRn      -- ^ expanded expression
-  -> HsExpr GhcRn      -- ^ suitably wrapped 'HsExpansion'
+  -> HsExpr GhcRn      -- ^ suitably wrapped 'XXExprGhcRn'
 mkExpandedPatRn oPat eExpr = XExpr (ExpandedThingRn (OrigPat oPat) eExpr)
 
 -- | Build an expression using the extension constructor `XExpr`,
@@ -516,7 +516,7 @@ mkExpandedStmtAt
   :: SrcSpanAnnA          -- ^ Location for the expansion expression
   -> ExprLStmt GhcRn      -- ^ source statement
   -> HsExpr GhcRn         -- ^ expanded expression
-  -> LHsExpr GhcRn        -- ^ suitably wrapped located 'HsExpansion'
+  -> LHsExpr GhcRn        -- ^ suitably wrapped located 'XXExprGhcRn'
 mkExpandedStmtAt loc oStmt eExpr = L loc $ mkExpandedStmt oStmt eExpr
 
 -- | Wrap the expanded version of the expression with a pop.
@@ -524,7 +524,7 @@ mkExpandedStmtPopAt
   :: SrcSpanAnnA          -- ^ Location for the expansion statement
   -> ExprLStmt GhcRn      -- ^ source statement
   -> HsExpr GhcRn         -- ^ expanded expression
-  -> LHsExpr GhcRn        -- ^ suitably wrapped 'HsExpansion'
+  -> LHsExpr GhcRn        -- ^ suitably wrapped 'XXExprGhcRn'
 mkExpandedStmtPopAt loc oStmt eExpr = mkPopErrCtxtExprAt loc $ mkExpandedStmtAt loc oStmt eExpr
 
 
@@ -532,9 +532,9 @@ data XXExprGhcTc
   = WrapExpr        -- Type and evidence application and abstractions
       {-# UNPACK #-} !(HsWrap HsExpr)
 
-  | ExpandedThingTc                         -- See Note [Rebindable syntax and HsExpansion]
-                                            -- See Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
-         { xtc_orig :: HsThingRn            -- The original user written thing
+  | ExpandedThingTc                         -- See Note [Rebindable syntax and XXExprGhcRn]
+                                            -- See Note [Expanding HsDo with XXExprGhcRn] in `GHC.Tc.Gen.Do`
+         { xtc_orig     :: HsThingRn        -- The original user written thing
          , xtc_expanded :: HsExpr GhcTc }   -- The expanded typechecked expression
 
   | ConLikeTc      -- Result of typechecking a data-con
@@ -556,22 +556,22 @@ data XXExprGhcTc
      Int                                -- module-local tick number for False
      (LHsExpr GhcTc)                    -- sub-expression
 
--- | Build a 'HsExpansion' out of an extension constructor,
+-- | Build a 'XXExprGhcRn' out of an extension constructor,
 --   and the two components of the expansion: original and
 --   expanded typechecked expressions.
 mkExpandedExprTc
   :: HsExpr GhcRn           -- ^ source expression
   -> HsExpr GhcTc           -- ^ expanded typechecked expression
-  -> HsExpr GhcTc           -- ^ suitably wrapped 'HsExpansion'
+  -> HsExpr GhcTc           -- ^ suitably wrapped 'XXExprGhcRn'
 mkExpandedExprTc oExpr eExpr = XExpr (ExpandedThingTc (OrigExpr oExpr) eExpr)
 
--- | Build a 'HsExpansion' out of an extension constructor.
+-- | Build a 'XXExprGhcRn' out of an extension constructor.
 --   The two components of the expansion are: original statement and
 --   expanded typechecked expression.
 mkExpandedStmtTc
   :: ExprLStmt GhcRn        -- ^ source do statement
   -> HsExpr GhcTc           -- ^ expanded typechecked expression
-  -> HsExpr GhcTc           -- ^ suitably wrapped 'HsExpansion'
+  -> HsExpr GhcTc           -- ^ suitably wrapped 'XXExprGhcRn'
 mkExpandedStmtTc oStmt eExpr = XExpr (ExpandedThingTc (OrigStmt oStmt) eExpr)
 
 {- *********************************************************************
@@ -1011,18 +1011,18 @@ isAtomicHsExpr (XExpr x)
   where
     go_x_tc :: XXExprGhcTc -> Bool
     go_x_tc (WrapExpr      (HsWrap _ e))     = isAtomicHsExpr e
-    go_x_tc (ExpandedThingTc thing _)        = isAtomicHsExpanded thing
+    go_x_tc (ExpandedThingTc thing _)        = isAtomicExpandedThingRn thing
     go_x_tc (ConLikeTc {})                   = True
     go_x_tc (HsTick {}) = False
     go_x_tc (HsBinTick {}) = False
 
     go_x_rn :: XXExprGhcRn -> Bool
-    go_x_rn (ExpandedThingRn thing _)    = isAtomicHsExpanded thing
+    go_x_rn (ExpandedThingRn thing _)    = isAtomicExpandedThingRn thing
     go_x_rn (PopErrCtxt (L _ a))         = isAtomicHsExpr a
 
-    isAtomicHsExpanded :: HsThingRn -> Bool
-    isAtomicHsExpanded (OrigExpr e) = isAtomicHsExpr e
-    isAtomicHsExpanded _            = False
+    isAtomicExpandedThingRn :: HsThingRn -> Bool
+    isAtomicExpandedThingRn (OrigExpr e) = isAtomicHsExpr e
+    isAtomicExpandedThingRn _            = False
 
 isAtomicHsExpr _ = False
 
@@ -1036,11 +1036,11 @@ instance Outputable (HsPragE (GhcPass p)) where
 
 {- *********************************************************************
 *                                                                      *
-             HsExpansion and rebindable syntax
+             XXExprGhcRn and rebindable syntax
 *                                                                      *
 ********************************************************************* -}
 
-{- Note [Rebindable syntax and HsExpansion]
+{- Note [Rebindable syntax and XXExprGhcRn]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 We implement rebindable syntax (RS) support by performing a desugaring
 in the renamer. We transform GhcPs expressions and patterns affected by
@@ -1074,12 +1074,12 @@ To remedy this, instead of transforming the original HsIf
 node into mere applications of 'ifThenElse', we keep the
 original 'if' expression around too, using the TTG
 XExpr extension point to allow GHC to construct an
-'HsExpansion' value that will keep track of the original
+'XXExprGhcRn' value that will keep track of the original
 expression in its first field, and the desugared one in the
 second field. The resulting renamed AST would look like:
 
     L locif (XExpr
-      (HsExpanded
+      (ExpandedThingRn
         (HsIf (L loca 'a')
               (L loctrue ())
               (L locfalse True)
@@ -1101,7 +1101,7 @@ second field. The resulting renamed AST would look like:
 When comes the time to typecheck the program, we end up calling
 tcMonoExpr on the AST above. If this expression gives rise to
 a type error, then it will appear in a context line and GHC
-will pretty-print it using the 'Outputable (HsExpansion a b)'
+will pretty-print it using the 'Outputable (XXExprGhcRn a b)'
 instance defined below, which *only prints the original
 expression*. This is the gist of the idea, but is not quite
 enough to recover the error messages that we had with the
@@ -1152,12 +1152,12 @@ A general recipe to follow this approach for new constructs could go as follows:
       HsVar/HsApp nodes, above) is set to 'generatedSrcSpan'
     - take both the original node and that rebound-and-renamed result and wrap
       them into an expansion construct:
-        for expressions, XExpr (HsExpanded <original node> <desugared>)
+        for expressions, XExpr (ExpandedThingRn <original node> <desugared>)
         for patterns, XPat (HsPatExpanded <original node> <desugared>)
  - At typechecking-time:
     - remove any logic that was previously dealing with your rebindable
       construct, typically involving [tc]SyntaxOp, SyntaxExpr and friends.
-    - the XExpr (HsExpanded ... ...) case in tcExpr already makes sure that we
+    - the XExpr (ExpandedThingRn ... ...) case in tcExpr already makes sure that we
       typecheck the desugared expression while reporting the original one in
       errors
 -}
@@ -1170,16 +1170,16 @@ syntax.
 The language extensions @OverloadedRecordDot@ and
 @OverloadedRecordUpdate@ (providing "record dot syntax") are
 implemented using the techniques of Note [Rebindable syntax and
-HsExpansion].
+XXExprGhcRn].
 
 When OverloadedRecordDot is enabled:
 - Field selection expressions
   - e.g. foo.bar.baz
   - Have abstract syntax HsGetField
-  - After renaming are XExpr (HsExpanded (HsGetField ...) (getField @"..."...)) expressions
+  - After renaming are XExpr (ExpandedThingRn (HsGetField ...) (getField @"..."...)) expressions
 - Field selector expressions e.g. (.x.y)
   - Have abstract syntax HsProjection
-  - After renaming are XExpr (HsExpanded (HsProjection ...) ((getField @"...") . (getField @"...") . ...) expressions
+  - After renaming are XExpr (ExpandedThingRn (HsProjection ...) ((getField @"...") . (getField @"...") . ...) expressions
 
 When OverloadedRecordUpdate is enabled:
 - Record update expressions
@@ -1187,7 +1187,7 @@ When OverloadedRecordUpdate is enabled:
   - Have abstract syntax RecordUpd
     - With rupd_flds containting a Right
     - See Note [RecordDotSyntax field updates] (in Language.Haskell.Syntax.Expr)
-  - After renaming are XExpr (HsExpanded (RecordUpd ...) (setField@"..." ...) expressions
+  - After renaming are XExpr (ExpandedThingRn (RecordUpd ...) (setField@"..." ...) expressions
     - Note that this is true for all record updates even for those that do not involve '.'
 
 When OverloadedRecordDot is enabled and RebindableSyntax is not
@@ -1203,18 +1203,6 @@ OverloadedRecordUpd is enabled and RebindableSyntax is enabled the
 names 'getField' and 'setField' are whatever in-scope names they are.
 -}
 
--- See Note [Rebindable syntax and HsExpansion] just above.
-data HsExpansion orig expanded
-  = HsExpanded { original :: orig        -- The original source thing
-               , expanded :: expanded }  -- The compiler generated expanded thing
-  deriving Data
-
--- | Just print the original expression (the @a@) with the expanded version (the @b@)
-instance (Outputable a, Outputable b) => Outputable (HsExpansion a b) where
-  ppr (HsExpanded orig expanded)
-    = ifPprDebug (vcat [ppr orig, braces (text "Expansion:" <+> ppr expanded)])
-               (ppr orig)
-
 
 {-
 ************************************************************************


=====================================
compiler/GHC/Hs/Pat.hs
=====================================
@@ -163,10 +163,10 @@ type instance XEmbTyPat GhcTc = Type
 type instance XXPat GhcPs = DataConCantHappen
 type instance XXPat GhcRn = HsPatExpansion (Pat GhcRn) (Pat GhcRn)
   -- Original pattern and its desugaring/expansion.
-  -- See Note [Rebindable syntax and HsExpansion].
+  -- See Note [Rebindable syntax and XXExprGhcRn].
 type instance XXPat GhcTc = XXPatGhcTc
-  -- After typechecking, we add extra constructors: CoPat and HsExpansion.
-  -- HsExpansion allows us to handle RebindableSyntax in pattern position:
+  -- After typechecking, we add extra constructors: CoPat and XXExprGhcRn.
+  -- XXExprGhcRn allows us to handle RebindableSyntax in pattern position:
   -- see "XXExpr GhcTc" for the counterpart in expressions.
 
 type instance ConLikeP GhcPs = RdrName -- IdP GhcPs
@@ -207,11 +207,11 @@ data XXPatGhcTc
       }
   -- | Pattern expansion: original pattern, and desugared pattern,
   -- for RebindableSyntax and other overloaded syntax such as OverloadedLists.
-  -- See Note [Rebindable syntax and HsExpansion].
+  -- See Note [Rebindable syntax and XXExprGhcRn].
   | ExpansionPat (Pat GhcRn) (Pat GhcTc)
 
 
--- See Note [Rebindable syntax and HsExpansion].
+-- See Note [Rebindable syntax and XXExprGhcRn].
 data HsPatExpansion a b
   = HsPatExpanded a b
   deriving Data
@@ -286,7 +286,7 @@ instance (Outputable p, OutputableBndr p, Outputable arg)
 instance OutputableBndrId p => Outputable (Pat (GhcPass p)) where
     ppr = pprPat
 
--- See Note [Rebindable syntax and HsExpansion].
+-- See Note [Rebindable syntax and XXExprGhcRn].
 instance (Outputable a, Outputable b) => Outputable (HsPatExpansion a b) where
   ppr (HsPatExpanded a b) = ifPprDebug (vcat [ppr a, ppr b]) (ppr a)
 


=====================================
compiler/GHC/HsToCore/Expr.hs
=====================================
@@ -931,7 +931,7 @@ warnUnusedBindValue fun arg@(L loc _) arg_ty
     -- Retrieve the location info and the head of the application
     -- It is important that we /do not/ look through HsApp to avoid
     -- generating duplicate warnings
-    -- See Part 2. of Note [Expanding HsDo with HsExpansion]
+    -- See Part 2. of Note [Expanding HsDo with XXExprGhcRn]
     fish_var :: LHsExpr GhcTc -> Maybe (SrcSpan , Id)
     fish_var (L l (HsVar _ id)) = return (locA l, unLoc id)
     fish_var (L _ (HsAppType _ e _ _)) = fish_var e


=====================================
compiler/GHC/HsToCore/Match.hs
=====================================
@@ -777,7 +777,7 @@ matchWrapper ctxt scrs (MG { mg_alts = L _ matches'
                        -- which have a do expansion origin
                        -- They generate spurious overlapping warnings
                        -- Due to pattern synonyms treated as refutable patterns
-                       -- See Part 1's Wrinkle 1 in Note [Expanding HsDo with HsExpansion] in GHC.Tc.Gen.Do
+                       -- See Part 1's Wrinkle 1 in Note [Expanding HsDo with XXExprGhcRn] in GHC.Tc.Gen.Do
                   else matches'
         ; new_vars    <- case matches of
                            []    -> newSysLocalsDs arg_tys


=====================================
compiler/GHC/HsToCore/Quote.hs
=====================================
@@ -1703,7 +1703,7 @@ Then, concerning the TH quotation,
       a type error from the splice.
 
 We consult the module-wide RebindableSyntax flag here. We could instead record
-the choice in HsExpanded, but it seems simpler to consult the flag (again).
+the choice in ExpandedThingRn, but it seems simpler to consult the flag (again).
 -}
 
 -----------------------------------------------------------------------------


=====================================
compiler/GHC/Iface/Ext/Ast.hs
=====================================
@@ -1129,7 +1129,7 @@ the typechecker:
     to ol_from_fun.
   * HsDo, where we give the SrcSpan of the entire do block to each
     ApplicativeStmt.
-  * HsExpanded ExplicitList{}, where we give the SrcSpan of the original
+  * Expanded (via ExpandedThingRn) ExplicitList{}, where we give the SrcSpan of the original
     list expression to the 'fromListN' call.
 
 In order for the implicit function calls to not be confused for actual


=====================================
compiler/GHC/Rename/Expr.hs
=====================================
@@ -91,7 +91,7 @@ import qualified Data.List.NonEmpty as NE
 Nomenclature
 -------------
 * Expansion (`HsExpr GhcRn -> HsExpr GhcRn`): expand between renaming and
-  typechecking, using the `HsExpansion` constructor of `HsExpr`.
+  typechecking, using the `XXExprGhcRn` constructor of `HsExpr`.
 * Desugaring (`HsExpr GhcTc -> Core.Expr`): convert the typechecked `HsSyn` to Core.  This is done in GHC.HsToCore
 
 
@@ -101,12 +101,12 @@ using overloaded labels #foo as an example:
 
 * In the RENAMER: transform
       HsOverLabel "foo"
-      ==> XExpr (HsExpansion (HsOverLabel #foo)
-                             (fromLabel `HsAppType` "foo"))
+      ==> XExpr (ExpandedThingRn (HsOverLabel #foo)
+                                 (fromLabel `HsAppType` "foo"))
   We write this more compactly in concrete-syntax form like this
       #foo  ==>  fromLabel @"foo"
 
-  Recall that in (HsExpansion orig expanded), 'orig' is the original term
+  Recall that in (ExpandedThingRn orig expanded), 'orig' is the original term
   the user wrote, and 'expanded' is the expanded or desugared version
   to be typechecked.
 
@@ -115,7 +115,7 @@ using overloaded labels #foo as an example:
   The typechecker (and desugarer) will never see HsOverLabel
 
 In effect, the renamer does a bit of desugaring. Recall GHC.Hs.Expr
-Note [Rebindable syntax and HsExpansion], which describes the use of HsExpansion.
+Note [Rebindable syntax and XXExprGhcRn], which describes the use of XXExprGhcRn.
 
 RebindableSyntax:
   If RebindableSyntax is off we use the built-in 'fromLabel', defined in
@@ -155,8 +155,8 @@ but several have a little bit of special treatment:
   where `leftSection` and `rightSection` are representation-polymorphic
   wired-in Ids. See Note [Left and right sections]
 
-* To understand why expansions for `OpApp` is done in `GHC.Tc.Gen.Head.splitHsApps` see
-  Part 0. of Note [Doing HsExpansion in the Renamer vs Typechecker] below.
+* To understand why expansions for `OpApp` is done in `GHC.Tc.Gen.Head.splitHsApps`
+  see Note [Doing XXExprGhcRn in the Renamer vs Typechecker] below.
 
 * RecordUpd: we desugar record updates into case expressions,
   in GHC.Tc.Gen.Expr.tcExpr.
@@ -179,7 +179,7 @@ but several have a little bit of special treatment:
   See Note [Record Updates] in GHC.Tc.Gen.Expr for more details.
 
   To understand Why is this done in the typechecker, and not in the renamer
-  see Part 1. of Note [Doing HsExpansion in the Renamer vs Typechecker]
+  see Note [Doing XXExprGhcRn in the Renamer vs Typechecker]
 
 * HsDo: We expand `HsDo` statements in `Ghc.Tc.Gen.Do`.
 
@@ -193,9 +193,9 @@ but several have a little bit of special treatment:
                          (\x -> ((>>) (g x)
                                       (return (f x))))
 
-     See Note [Expanding HsDo with HsExpansion] in `Ghc.Tc.Gen.Do` for more details.
-     To understand why is this done in the typechecker and not in the renamer see
-     Part 2. of Note [Doing HsExpansion in the Renamer vs Typechecker]
+     See Note [Expanding HsDo with XXExprGhcRn] in `Ghc.Tc.Gen.Do` for more details.
+     To understand why is this done in the typechecker and not in the renamer.
+     See Note [Doing XXExprGhcRn in the Renamer vs Typechecker]
 
 Note [Overloaded labels]
 ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -216,7 +216,7 @@ type-applying to "foo", so we get
 And those inferred kind quantifiers will indeed be instantiated when we
 typecheck the renamed-syntax call (fromLabel @"foo").
 
-Note [Doing HsExpansion in the Renamer vs Typechecker]
+Note [Doing XXExprGhcRn in the Renamer vs Typechecker]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 We expand some `HsExpr GhcRn` code at various places, usually, on the fly,
 depending on when it is more convenient. It may be beneficial to have a
@@ -225,18 +225,25 @@ in the future when we have enough cases to cater for. For the time being,
 this note documents which language feature is expanded at which phase,
 and the reasons for doing so.
 
-  Part 0. `OpApp` Expansions
-  ------------------------
-  The typechecker turns `OpApp` into a use of `HsExpansion`
+  ** `HsIf` Expansions
+  --------------------
+  `HsIf` expansions are expanded in the Renamer becuase it is more convinent
+  to do so there and then not worry about it in the later stage.
+  `-XRebindableSyntax` is used to decide whether we use the `HsIf` or user defined if
+
+
+  ** `OpApp` Expansions
+  ---------------------
+  The typechecker turns `OpApp` into a use of `XXExprGhcRn`
   on the fly, in `GHC.Tc.Gen.Head.splitHsApps`.
   The language extension `RebindableSyntax` does not affect this behaviour.
 
-  It's a bit painful to transform `OpApp e1 op e2` to a `HsExpansion`
+  It's a bit painful to transform `OpApp e1 op e2` to a `XXExprGhcRn`
   form, because the renamer does precedence rearrangement after name
   resolution. So the renamer leaves an `OpApp` as an `OpApp`.
 
-  Part 1. Record Update Syntax `RecordUpd` Expansions
-  ---------------------------------------------------
+  ** Record Update Syntax `RecordUpd` Expansions
+  ----------------------------------------------
   This is done in the typechecker on the fly (`GHC.Tc.Expr.tcExpr`), and not the renamer, for two reasons:
 
     - (Until we implement GHC proposal #366)
@@ -253,7 +260,7 @@ and the reasons for doing so.
       in which an updated field has a higher-rank type.
       See Wrinkle [Using IdSig] in Note [Record Updates] in GHC.Tc.Gen.Expr.
 
-  Part 2. `HsDo` Statement Expansions
+  ** `HsDo` Statement Expansions
   -----------------------------------
   The expansion for do block statements is done on the fly right before typechecking in `GHC.Tc.Gen.Expr`
   using `GHC.Tc.Gen.Do.expandDoStmts`. There are 2 main reasons:
@@ -261,7 +268,7 @@ and the reasons for doing so.
   -  During the renaming phase, we may not have all the constructor details `HsConDetails` populated in the
      data structure. This would result in an inaccurate irrefutability analysis causing
      the continuation lambda body to be wrapped with `fail` alternatives when not needed.
-     See Part 1. of Note [Expanding HsDo with HsExpansion] (test pattern-fails.hs)
+     See Part 1. of Note [Expanding HsDo with XXExprGhcRn] (test pattern-fails.hs)
 
   -  If the expansion is done on the fly during renaming, expressions that
      have explicit type applications using (-XTypeApplciations) will not work (cf. Let statements expansion)
@@ -2749,7 +2756,7 @@ getMonadFailOp ctxt
 
 {- *********************************************************************
 *                                                                      *
-              Generating code for HsExpanded
+              Generating code for ExpandedThingRn
       See Note [Handling overloaded and rebindable constructs]
 *                                                                      *
 ********************************************************************* -}


=====================================
compiler/GHC/Rename/Pat.hs
=====================================
@@ -315,7 +315,7 @@ Note [Handling overloaded and rebindable patterns]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Overloaded paterns and rebindable patterns are desugared in the renamer
 using the HsPatExpansion mechanism detailed in:
-Note [Rebindable syntax and HsExpansion]
+Note [Rebindable syntax and XXExprGhcRn]
 The approach is similar to that of expressions, which is further detailed
 in Note [Handling overloaded and rebindable constructs] in GHC.Rename.Expr.
 
@@ -343,7 +343,7 @@ If OverloadedLists is enabled, we desugar a list pattern to a view pattern:
   toList -> [p1, p2, p3]
 
 This happens directly in the renamer, using the HsPatExpansion mechanism
-detailed in Note [Rebindable syntax and HsExpansion].
+detailed in Note [Rebindable syntax and XXExprGhcRn].
 
 Note that we emit a special view pattern: we additionally keep track of an
 inverse to the pattern.


=====================================
compiler/GHC/Rename/Utils.hs
=====================================
@@ -713,14 +713,14 @@ checkCTupSize tup_size
 
 {- *********************************************************************
 *                                                                      *
-              Generating code for HsExpanded
+              Generating code for ExpandedThingRn
       See Note [Handling overloaded and rebindable constructs]
 *                                                                      *
 ********************************************************************* -}
 
 wrapGenSpan :: (NoAnn an) => a -> LocatedAn an a
 -- Wrap something in a "generatedSrcSpan"
--- See Note [Rebindable syntax and HsExpansion]
+-- See Note [Rebindable syntax and XXExprGhcRn]
 wrapGenSpan x = L (noAnnSrcSpan generatedSrcSpan) x
 
 genHsApps :: Name -> [LHsExpr GhcRn] -> HsExpr GhcRn


=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -4933,7 +4933,7 @@ pprWithArising (ct:cts)
 {- Note ["Arising from" messages in generated code]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Consider code generated when we desugar code before typechecking;
-see Note [Rebindable syntax and HsExpansion].
+see Note [Rebindable syntax and XXExprGhcRn].
 
 In this code, constraints may be generated, but we don't want to
 say "arising from a call of foo" if 'foo' doesn't appear in the


=====================================
compiler/GHC/Tc/Gen/App.hs
=====================================
@@ -775,7 +775,7 @@ addArgCtxt :: AppCtxt -> LHsExpr GhcRn
 --    (VAExpansion), just use the less-informative context
 --          "In the expression: arg"
 --   Unless the arg is also a generated thing, in which case do nothing.
---   See Note [Rebindable syntax and HsExpansion] in GHC.Hs.Expr
+--   See Note [Rebindable syntax and XXExprGhcRn] in GHC.Hs.Expr
 -- 3. We are in an expanded do block's non-bind statement
 --    we simply add the statement context
 --       "In the statement of the do block .."
@@ -784,7 +784,7 @@ addArgCtxt :: AppCtxt -> LHsExpr GhcRn
 --       so we set the location to be that of the argument
 --    b. Or, we are typechecking the second argument which would likely be a generated lambda
 --       so we set the location to be whatever the location in the context is
---  See Note [Expanding HsDo with HsExpansion] in GHC.Tc.Gen.Match
+--  See Note [Expanding HsDo with XXExprGhcRn] in GHC.Tc.Gen.Do
 addArgCtxt ctxt (L arg_loc arg) thing_inside
   = do { in_generated_code <- inGeneratedCode
        ; case ctxt of


=====================================
compiler/GHC/Tc/Gen/Do.hs
=====================================
@@ -44,14 +44,14 @@ import Data.List ((\\))
 {-
 ************************************************************************
 *                                                                      *
-\subsection{HsExpansion for Do Statements}
+\subsection{XXExprGhcRn for Do Statements}
 *                                                                      *
 ************************************************************************
 -}
 
 -- | Expand the `do`-statments into expressions right after renaming
 --   so that they can be typechecked.
---   See Note [Expanding HsDo with HsExpansion] below for `HsDo` specific commentary
+--   See Note [Expanding HsDo with XXExprGhcRn] below for `HsDo` specific commentary
 --   and Note [Handling overloaded and rebindable constructs] for high level commentary
 expandDoStmts :: HsDoFlavour -> [ExprLStmt GhcRn] -> TcM (LHsExpr GhcRn)
 expandDoStmts doFlav stmts = do expanded_expr <- expand_do_stmts doFlav stmts
@@ -63,7 +63,7 @@ expandDoStmts doFlav stmts = do expanded_expr <- expand_do_stmts doFlav stmts
                                          _                          -> return expanded_expr
 
 -- | The main work horse for expanding do block statements into applications of binds and thens
---   See Note [Expanding HsDo with HsExpansion]
+--   See Note [Expanding HsDo with XXExprGhcRn]
 expand_do_stmts :: HsDoFlavour -> [ExprLStmt GhcRn] -> TcM (LHsExpr GhcRn)
 
 expand_do_stmts ListComp _ =
@@ -86,7 +86,7 @@ expand_do_stmts _ (stmt@(L _ (ApplicativeStmt{})): _) =
 
 
 expand_do_stmts _ [stmt@(L loc (LastStmt _ (L body_loc body) _ ret_expr))]
--- See  Note [Expanding HsDo with HsExpansion] Equation (5) below
+-- See  Note [Expanding HsDo with XXExprGhcRn] Equation (5) below
 -- last statement of a list comprehension, needs to explicitly return it
 -- See `checkLastStmt` and `Syntax.Expr.StmtLR.LastStmt`
    | NoSyntaxExprRn <- ret_expr
@@ -104,7 +104,7 @@ expand_do_stmts _ [stmt@(L loc (LastStmt _ (L body_loc body) _ ret_expr))]
         return $ mkExpandedStmtPopAt loc stmt expansion
 
 expand_do_stmts do_or_lc (stmt@(L loc (LetStmt _ bs)) : lstmts) =
--- See  Note [Expanding HsDo with HsExpansion] Equation (3) below
+-- See  Note [Expanding HsDo with XXExprGhcRn] Equation (3) below
 --                      stmts ~~> stmts'
 --    ------------------------------------------------
 --       let x = e ; stmts ~~> let x = e in stmts'
@@ -115,7 +115,7 @@ expand_do_stmts do_or_lc (stmt@(L loc (LetStmt _ bs)) : lstmts) =
 expand_do_stmts do_or_lc (stmt@(L loc (BindStmt xbsrn pat e)): lstmts)
   | SyntaxExprRn bind_op <- xbsrn_bindOp xbsrn
   , fail_op              <- xbsrn_failOp xbsrn
--- See  Note [Expanding HsDo with HsExpansion] Equation (2) below
+-- See  Note [Expanding HsDo with XXExprGhcRn] Equation (2) below
 -- the pattern binding pat can fail
 --      stmts ~~> stmt'    f = \case pat -> stmts';
 --                                   _   -> fail "Pattern match failure .."
@@ -133,7 +133,7 @@ expand_do_stmts do_or_lc (stmt@(L loc (BindStmt xbsrn pat e)): lstmts)
 
 expand_do_stmts do_or_lc (stmt@(L loc (BodyStmt _ e (SyntaxExprRn then_op) _)) : lstmts) =
 -- See Note [BodyStmt] in Language.Haskell.Syntax.Expr
--- See  Note [Expanding HsDo with HsExpansion] Equation (1) below
+-- See  Note [Expanding HsDo with XXExprGhcRn] Equation (1) below
 --              stmts ~~> stmts'
 --    ----------------------------------------------
 --      e ; stmts ~~> (>>) e stmts'
@@ -155,7 +155,7 @@ expand_do_stmts do_or_lc
                         }))
          : lstmts) =
 -- See Note [Typing a RecStmt] in Language.Haskell.Syntax.Expr
--- See  Note [Expanding HsDo with HsExpansion] Equation (4) and (6) below
+-- See  Note [Expanding HsDo with XXExprGhcRn] Equation (4) and (6) below
 --                                   stmts ~~> stmts'
 --    -------------------------------------------------------------------------------------------
 --      rec { later_ids, local_ids, rec_block } ; stmts
@@ -235,9 +235,9 @@ mk_fail_block doFlav pat@(L ploc _) e (Just (SyntaxExprRn fail_op)) =
 mk_fail_block _ _ _ _ = pprPanic "mk_fail_block: impossible happened" empty
 
 
-{- Note [Expanding HsDo with HsExpansion]
+{- Note [Expanding HsDo with XXExprGhcRn]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-We expand `do`-blocks before typechecking it, by re-using the existing `HsExpansions` and `RebindableSyntax` machinery.
+We expand `do`-blocks before typechecking it, by re-using the existing `XXExprGhcRns` and `RebindableSyntax` machinery.
 This is very similar to:
   1. Expansions done in `GHC.Rename.Expr.rnHsIf` for expanding `HsIf`; and
   2. `desugarRecordUpd` in `GHC.Tc.Gen.Expr.tcExpr` for expanding `RecordUpd`
@@ -247,7 +247,7 @@ To disabmiguate desugaring (`HsExpr GhcTc -> Core.Expr`) we use the phrase expan
 (`HsExpr GhcRn -> HsExpr GhcRn`)
 
 This expansion is done right before typechecking and after renaming
-See Part 2. of Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr`
+See Part 2. of Note [Doing XXExprGhcRn in the Renamer vs Typechecker] in `GHC.Rename.Expr`
 
 Historical note START
 ---------------------
@@ -423,8 +423,8 @@ It stores the original statement (with location) and the expanded expression
   * Whenever the typechecker steps through an `ExpandedThingRn`,
     we push the original statement in the error context, set the error location to the
     location of the statement, and then typecheck the expanded expression.
-    This is similar to vanilla `HsExpansion` and rebindable syntax
-    See Note [Rebindable syntax and HsExpansion] in `GHC.Hs.Expr`.
+    This is similar to vanilla `XXExprGhcRn` and rebindable syntax
+    See Note [Rebindable syntax and XXExprGhcRn] in `GHC.Hs.Expr`.
 
   * Recall, that when a source function argument fails to typecheck,
     we print an error message like "In the second argument of the function f..".


=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -195,7 +195,7 @@ tcExpr :: HsExpr GhcRn -> ExpRhoType -> TcM (HsExpr GhcTc)
 --   - HsAppType       type applications
 --   - ExprWithTySig   (e :: type)
 --   - HsRecSel        overloaded record fields
---   - HsExpanded      renamer expansions
+--   - ExpandedThingRn renamer/pre-typechecker expansions
 --   - HsOpApp         operator applications
 --   - HsOverLit       overloaded literals
 -- These constructors are the union of
@@ -270,7 +270,7 @@ tcExpr e@(HsLam x lam_variant matches) res_ty
   where
     match_ctxt
       | Just f <- doExpansionFlavour (mg_ext matches)
-      -- See Part 3. B. of Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`. Testcase: Typeable1
+      -- See Part 3. B. of Note [Expanding HsDo with XXExprGhcRn] in `GHC.Tc.Gen.Do`. Testcase: Typeable1
       = MC { mc_what = StmtCtxt (HsDoStmt f)
            , mc_body = tcBodyNC -- NB: Do not add any error contexts
                                 -- It has already been done
@@ -432,7 +432,7 @@ tcExpr hsDo@(HsDo _ do_or_lc@(DoExpr{}) ss@(L _  stmts)) res_ty
 -- In the case of vanilla do expression.
 -- We expand the statements into explicit application of binds, thens and lets
 -- This helps in infering the right types for bind expressions when impredicativity is turned on
--- See Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
+-- See Note [Expanding HsDo with XXExprGhcRn] in `GHC.Tc.Gen.Do`
   = do { isApplicativeDo <- xoptM LangExt.ApplicativeDo
        ; if isApplicativeDo
          then tcDoStmts do_or_lc ss res_ty  -- Use tcSyntaxOp if ApplicativeDo is turned on
@@ -654,7 +654,7 @@ tcExpr (SectionR {})       ty = pprPanic "tcExpr:SectionR"    (ppr ty)
 tcXExpr :: XXExprGhcRn -> ExpRhoType -> TcM (HsExpr GhcTc)
 
 tcXExpr (PopErrCtxt (L loc e)) res_ty
-  = popErrCtxt $ -- See Part 3 of Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
+  = popErrCtxt $ -- See Part 3 of Note [Expanding HsDo with XXExprGhcRn] in `GHC.Tc.Gen.Do`
       setSrcSpanA loc $
       tcExpr e res_ty
 
@@ -675,7 +675,7 @@ tcXExpr xe@(ExpandedThingRn o e) res_ty
                 -- It is important that we call tcExpr (and not tcApp) here as
                 -- `e` is just the last statement's body expression
                 -- and not a HsApp of a generated (>>) or (>>=)
-                -- This improves error messages e.g. T18324b.hs
+                -- This improves error messages e.g. DoExpansion1, DoExpansion2, DoExpansion3
   | OrigStmt ls@(L loc _) <- o
   = setSrcSpanA loc $
        mkExpandedStmtTc ls <$> tcApp (XExpr xe) res_ty
@@ -1042,7 +1042,7 @@ we take the following steps:
   (0) Perform a first typechecking pass on the record expression (`e` in the example above),
       to infer the type of the record being updated.
   (1) Disambiguate the record fields (potentially using the type obtained in (0)).
-  (2) Desugar the record update as described above, using an HsExpansion.
+  (2) Desugar the record update as described above, using an XXExprGhcRn.
       (a) Create a let-binding to share the record update right-hand sides.
       (b) Desugar the record update to a case expression updating all the
           relevant constructors (those that have all of the fields being updated).


=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -155,7 +155,7 @@ takes apart either an HsApp, or an infix OpApp, returning
 * The "user head" or "error head" of the application, to be reported to the
   user in case of an error.  Example:
          (`op` e)
-  expands (via HsExpanded) to
+  expands (via ExpandedThingRn) to
          (rightSection op e)
   but we don't want to see 'rightSection' in error messages. So we keep the
   innermost un-expanded head as the "error head".
@@ -323,7 +323,7 @@ splitHsApps e = go e (top_ctxt 0 e) []
             HsUntypedSpliceExpr _ (L l _) -> set l ctxt -- l :: SrcAnn AnnListItem
             HsQuasiQuote _ _ (L l _)      -> set l ctxt -- l :: SrcAnn NoEpAnns
 
-    -- See Note [Looking through HsExpanded]
+    -- See Note [Looking through ExpandedThingRn]
     go (XExpr (ExpandedThingRn o e)) ctxt args
       | isHsThingRnExpr o
       = go e (VAExpansion o (appCtxtLoc ctxt) (appCtxtLoc ctxt))
@@ -332,14 +332,14 @@ splitHsApps e = go e (top_ctxt 0 e) []
       | OrigStmt (L _ stmt) <- o                -- so that we set `(>>)` as generated
       , BodyStmt{} <- stmt                      -- and get the right unused bind warnings
       = go e (VAExpansion o generatedSrcSpan generatedSrcSpan)
-                                                -- See Part 3. in Note [Expanding HsDo with HsExpansion]
+                                                -- See Part 3. in Note [Expanding HsDo with XXExprGhcRn]
                (EWrap (EExpand o) : args)       -- in `GHC.Tc.Gen.Do`
 
 
       | OrigPat (L loc _) <- o                              -- so that we set the compiler generated fail context
       = go e (VAExpansion o (locA loc) (locA loc))          -- to be originating from a failable pattern
                                                             -- See Part 1. Wrinkle 2. of
-               (EWrap (EExpand o) : args)                   -- Note [Expanding HsDo with HsExpansion]
+               (EWrap (EExpand o) : args)                   -- Note [Expanding HsDo with XXExprGhcRn]
                                                             -- in `GHC.Tc.Gen.Do`
 
       | otherwise
@@ -783,25 +783,25 @@ pprHsExprArgTc arg = ppr arg
 Operator sections are desugared in the renamer; see GHC.Rename.Expr
 Note [Handling overloaded and rebindable constructs].
 But for reasons explained there, we rename OpApp to OpApp.  Then,
-here in the typechecker, we desugar it to a use of HsExpanded.
+here in the typechecker, we desugar it to a use of ExpandedThingRn.
 That makes it possible to typecheck something like
      e1 `f` e2
 where
    f :: forall a. t1 -> forall b. t2 -> t3
 
-Note [Looking through HsExpanded]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Note [Looking through ExpandedThingRn]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 When creating an application chain in splitHsApps, we must deal with
-     HsExpanded f1 (f `HsApp` e1) `HsApp` e2 `HsApp` e3
+     ExpandedThingRn f1 (f `HsApp` e1) `HsApp` e2 `HsApp` e3
 
 as a single application chain `f e1 e2 e3`.  Otherwise stuff like overloaded
 labels (#19154) won't work.
 
-It's easy to achieve this: `splitHsApps` unwraps `HsExpanded`.
+It's easy to achieve this: `splitHsApps` unwraps `ExpandedThingRn`.
 
 In order to be able to more accurately reconstruct the original `SrcSpan`s
 from the renamer in `rebuildHsApps`, we also have to track the `SrcSpan`
-of the current application in `VAExpansion` when unwrapping `HsExpanded`
+of the current application in `VAExpansion` when unwrapping `ExpandedThingRn`
 in `splitHsApps`, just as we track it in a non-expanded expression.
 
 Previously, `rebuildHsApps` substituted the location of the original


=====================================
compiler/GHC/Tc/Types/LclEnv.hs
=====================================
@@ -90,7 +90,7 @@ data TcLclCtxt
   = TcLclCtxt {
         tcl_loc        :: RealSrcSpan,     -- Source span
         tcl_ctxt       :: [ErrCtxt],       -- Error context, innermost on top
-        tcl_in_gen_code :: Bool,           -- See Note [Rebindable syntax and HsExpansion]
+        tcl_in_gen_code :: Bool,           -- See Note [Rebindable syntax and XXExprGhcRn]
         tcl_tclvl      :: TcLevel,
         tcl_bndrs      :: TcBinderStack,   -- Used for reporting relevant bindings,
                                            -- and for tidying type


=====================================
compiler/GHC/Tc/Utils/Monad.hs
=====================================
@@ -1219,7 +1219,7 @@ Note [Error contexts in generated code]
 
 So typically it's better to do setSrcSpan /before/ addErrCtxt.
 
-See Note [Rebindable syntax and HsExpansion] in GHC.Hs.Expr for
+See Note [Rebindable syntax and XXExprGhcRn] in GHC.Hs.Expr for
 more discussion of this fancy footwork, as well as
 Note [Generated code and pattern-match checking] in GHC.Types.Basic for the
 relation with pattern-match checks.
@@ -1263,7 +1263,7 @@ pushCtxt ctxt = updLclEnv (updCtxt ctxt)
 
 updCtxt :: ErrCtxt -> TcLclEnv -> TcLclEnv
 -- Do not update the context if we are in generated code
--- See Note [Rebindable syntax and HsExpansion] in GHC.Hs.Expr
+-- See Note [Rebindable syntax and XXExprGhcRn] in GHC.Hs.Expr
 updCtxt ctxt env
   | lclEnvInGeneratedCode env = env
   | otherwise = addLclEnvErrCtxt ctxt env


=====================================
compiler/GHC/Types/Basic.hs
=====================================
@@ -600,7 +600,7 @@ isGenerated FromSource   = False
 
 -- | This metadata stores the information as to why was the piece of code generated
 --   It is useful for generating the right error context
--- See Part 3 in Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
+-- See Part 3 in Note [Expanding HsDo with XXExprGhcRn] in `GHC.Tc.Gen.Do`
 data GenReason = DoExpansion HsDoFlavour
                | OtherExpansion
                deriving (Eq, Data)
@@ -613,11 +613,11 @@ doExpansionFlavour :: Origin -> Maybe HsDoFlavour
 doExpansionFlavour (Generated (DoExpansion f) _) = Just f
 doExpansionFlavour _ = Nothing
 
--- See Part 3 in Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
+-- See Part 3 in Note [Expanding HsDo with XXExprGhcRn] in `GHC.Tc.Gen.Do`
 isDoExpansionGenerated :: Origin -> Bool
 isDoExpansionGenerated = isJust . doExpansionFlavour
 
--- See Part 3 in Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
+-- See Part 3 in Note [Expanding HsDo with XXExprGhcRn] in `GHC.Tc.Gen.Do`
 doExpansionOrigin :: HsDoFlavour -> Origin
 doExpansionOrigin f = Generated (DoExpansion f) DoPmc
                     -- It is important that we perfrom PMC
@@ -652,7 +652,7 @@ requiresPMC _ = True
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Some parts of the compiler generate code that is then typechecked. For example:
 
-  - the HsExpansion mechanism described in Note [Rebindable syntax and HsExpansion]
+  - the XXExprGhcRn mechanism described in Note [Rebindable syntax and XXExprGhcRn]
     in GHC.Hs.Expr,
   - the deriving mechanism.
 


=====================================
compiler/Language/Haskell/Syntax/Expr.hs
=====================================
@@ -240,7 +240,7 @@ this if both data types are declared in the same module.
 
 NB 2: The notation getField @"size" e is short for
 HsApp (HsAppType (HsVar "getField") (HsWC (HsTyLit (HsStrTy "size")) [])) e.
-We track the original parsed syntax via HsExpanded.
+We track the original parsed syntax via ExpandedThingRn.
 
 -}
 
@@ -588,7 +588,7 @@ data HsExpr p
 
   | XExpr       !(XXExpr p)
   -- Note [Trees That Grow] in Language.Haskell.Syntax.Extension for the
-  -- general idea, and Note [Rebindable syntax and HsExpansion] in GHC.Hs.Expr
+  -- general idea, and Note [Rebindable syntax and XXExprGhcRn] in GHC.Hs.Expr
   -- for an example of how we use it.
 
 -- ---------------------------------------------------------------------



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e8bdbd78f102e72b33208a491c7d33c1b7f43397
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/20231016/59f36bd4/attachment-0001.html>


More information about the ghc-commits mailing list