[Git][ghc/ghc][wip/ani/T27156] HsQualLit via Expand
Apoorv Ingle pushed to branch wip/ani/T27156 at Glasgow Haskell Compiler / GHC Commits: 20ed7c20 by Apoorv Ingle at 2026-04-19T20:24:26-05:00 HsQualLit via Expand - - - - - 2 changed files: - compiler/GHC/Rename/Expr.hs - compiler/GHC/Tc/Gen/Expand.hs Changes: ===================================== compiler/GHC/Rename/Expr.hs ===================================== @@ -40,7 +40,6 @@ import GHC.Rename.Unbound ( reportUnboundName ) import GHC.Rename.Splice ( rnTypedBracket, rnUntypedBracket, rnTypedSplice , rnUntypedSpliceExpr, checkThLocalNameWithLift, checkThLocalNameNoLift ) import GHC.Rename.HsType -import GHC.Rename.Lit import GHC.Rename.Pat import GHC.Driver.DynFlags @@ -369,10 +368,18 @@ rnExpr (HsOverLit x lit) return (HsApp noExtField (noLocA neg) (noLocA (HsOverLit x lit')) , fvs ) } -rnExpr (HsQualLit x lit) = do - ((lit', desugaredExpr), fvs) <- rnQualLit lit - let origExpr = HsQualLit x lit' - return (mkExpandedExpr origExpr desugaredExpr, fvs) +rnExpr (HsQualLit x lit) + = do { (lit', fvs) <- rnQualLit lit + ; return (HsQualLit x lit', fvs) + } + + where + rnQualLit :: HsQualLit GhcPs -> RnM (HsQualLit GhcRn, FreeNames) + rnQualLit QualLit{..} + = do { (funName, fvs) <- lookupNameWithQualifier fromStringName ql_mod + ; let lit = QualLit{ql_ext = L noAnn funName, ..} + ; pure (lit, fvs) } + rnExpr (HsApp x fun arg) = do { (fun',fvFun) <- rnLExpr fun ===================================== compiler/GHC/Tc/Gen/Expand.hs ===================================== @@ -131,6 +131,20 @@ tcExpand e@(HsOverLabel (_, rs_table) v) | otherwise = pprPanic "tcExpand" (vcat [ text "Should Never Happen: could not find fromLabel in rs_table" , ppr e] ) + +------------------------------------------ +-- Qualified Literals +tcExpand e@(HsQualLit _ QualLit{ql_val = ql_val, ql_ext = (L _ fromStringName)}) + = do { let hsLit = case ql_val of + -- See Note [Implementation of QualifiedStrings] + HsQualString st s -> HsString st s + ; return $ Just $ + HSE { hse_ctxt = ExprCtxt e + , hse_exp = wrapGenSpan $ genHsApps fromStringName [genLHsLit hsLit] + } + } + + ------------------------------------------ -- Operator Applications tcExpand e@(OpApp _ arg1 op arg2) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/20ed7c203b886f44541defd1eefee74b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/20ed7c203b886f44541defd1eefee74b... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Apoorv Ingle (@ani)