Apoorv Ingle pushed to branch wip/ani/T27156 at Glasgow Haskell Compiler / GHC Commits: 0ebd3306 by Apoorv Ingle at 2026-04-21T19:43:24-05:00 expand the bracket expression before puting it in typed bracket - - - - - 3 changed files: - compiler/GHC/HsToCore/Quote.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/Splice.hs Changes: ===================================== compiler/GHC/HsToCore/Quote.hs ===================================== @@ -44,8 +44,6 @@ import GHC.Tc.Types.Evidence import GHC.Tc.Types.ErrCtxt import GHC.Tc.TyCl ( IsPrefixConGADT(..), unannotatedMultIsLinear ) -import GHC.Tc.Gen.Expand ( tcExpandNoTcM ) - import GHC.Core.Class import GHC.Core.DataCon import GHC.Core.TyCon @@ -1620,13 +1618,11 @@ repE (HsCase _ e (MG { mg_alts = (L _ ms) })) ; ms2 <- mapM repMatchTup ms ; core_ms2 <- coreListM matchTyConName ms2 ; repCaseE arg core_ms2 } -repE e@(HsIf _ x y z) = case (tcExpandNoTcM e) of - Nothing -> do { a <- repLE x - ; b <- repLE y - ; c <- repLE z - ; repCond a b c } - Just (HSE _ (L _ e')) -> repE e' - +repE (HsIf _ x y z) = do + a <- repLE x + b <- repLE y + c <- repLE z + repCond a b c repE (HsMultiIf _ alts) = do { (binds, alts') <- NE.unzip <$> mapM repLGRHS alts ; expr' <- repMultiIf (nonEmptyCoreList' alts') ===================================== compiler/GHC/Rename/Expr.hs ===================================== @@ -554,7 +554,7 @@ rnExpr (RecordUpd { rupd_expr = L l expr, rupd_flds = rbinds }) ; let upd_flds = OverloadedRecUpdFields { xOLRecUpdFields = noExtField , olRecUpdFields = us } - rs_table = Rebindable [(nameOccName getField, getField) , (nameOccName getField, setField)] + rs_table = Rebindable [(nameOccName getField, getField) , (nameOccName setField, setField)] ; return (RecordUpd rs_table (L l e) upd_flds , plusFNs [fv_getField, fv_setField, fv_e, fv_us] ) } ===================================== compiler/GHC/Rename/Splice.hs ===================================== @@ -24,6 +24,7 @@ import GHC.Hs import GHC.Types.Name.Reader import GHC.Tc.Errors.Types import GHC.Tc.Utils.Monad +import GHC.Tc.Gen.Expand import GHC.Driver.Env.Types import GHC.Rename.Env @@ -141,9 +142,12 @@ rnTypedBracket e br_body ; recordThUse ; traceRn "Renaming typed TH bracket" empty - ; (body', fvs_e) <- setThLevel (Brack cur_level RnPendingTyped) $ rnLExpr br_body - ; return (HsTypedBracket noExtField body', fvs_e) - + ; (body'@(L loc b) , fvs_e) <- setThLevel (Brack cur_level RnPendingTyped) $ rnLExpr br_body + -- ; return (HsTypedBracket noExtField body', fvs_e) + ; mb_b <- tcExpand b + ; case mb_b of + Nothing -> return (HsTypedBracket noExtField body', fvs_e) + Just hse -> return (HsTypedBracket noExtField (L loc (XExpr (ExpandedThingRn hse))), fvs_e) } rnUntypedBracket :: HsExpr GhcPs -> HsQuote GhcPs -> RnM (HsExpr GhcRn, FreeNames) @@ -176,6 +180,7 @@ rnUntypedBracket e br_body setThLevel (UntypedBrack cur_level ps_var) $ rn_utbracket br_body ; pendings <- readMutVar ps_var + ; return (HsUntypedBracket pendings body', fvs_e) } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0ebd33068664ea1f6bb6c0650e2c41a0... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0ebd33068664ea1f6bb6c0650e2c41a0... You're receiving this email because of your account on gitlab.haskell.org.