27 Jul
2026
27 Jul
'26
2:07 a.m.
Apoorv Ingle pushed to branch wip/ani/T27156 at Glasgow Haskell Compiler / GHC
Commits:
fb071d39 by Apoorv Ingle at 2026-07-26T21:07:30-05:00
rebase changes
- - - - -
5 changed files:
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Tc/Gen/Expand.hs
- testsuite/tests/ghc-api/T25121_status.stdout
- testsuite/tests/th/T18102b.hs
- testsuite/tests/th/T18102b_aux.hs
Changes:
=====================================
compiler/GHC/Rename/Expr.hs
=====================================
@@ -3,6 +3,7 @@
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
+{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
@@ -351,8 +352,9 @@ rnExpr (HsOverLit x lit)
rnExpr (HsQualLit x QualLit{..})
= do { (funName, fvs) <- lookupNameWithQualifier fromStringName ql_mod
- ; let lit' = QualLit{ql_ext = L noAnn funName, ..}
- ; return (HsQualLit x lit', fvs)
+ ; let ql_val' = case ql_val of
+ HsQualString st s -> HsQualString st s
+ ; return (HsQualLit x (QualLit (L noAnn funName) ql_mod ql_val'), fvs)
}
rnExpr (HsApp x fun arg)
=====================================
compiler/GHC/Tc/Gen/Expand.hs
=====================================
@@ -21,7 +21,7 @@ import GHC.Types.Name
import GHC.Types.Name.Reader
import GHC.Types.Id.Make
import GHC.Types.SrcLoc
-import GHC.Types.SourceText ( mkIntegralLit , SourceText(..) )
+import GHC.Types.SourceText ( SourceText(..) )
import GHC.Builtin.Names
=====================================
testsuite/tests/ghc-api/T25121_status.stdout
=====================================
@@ -45,7 +45,7 @@ X(ExprWithTySig) mismatch
<<< EpUniToken "::" "\8759"
X(UntypedSplice) mismatch
>>> HsUntypedSpliceResult (HsExpr (GhcPass 'Renamed))
- <<< HsUntypedSpliceResult (GenLocated (EpAnn AnnListItem) (HsType (GhcPass 'Renamed)))
+ <<< HsUntypedSpliceResult (GenLocated (EpAnn [TrailingAnn]) (HsType (GhcPass 'Renamed)))
X(ExplicitList) mismatch
>>> RebindableSyntaxTable
<<< NoExtField
=====================================
testsuite/tests/th/T18102b.hs
=====================================
@@ -1,9 +1,47 @@
-{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TemplateHaskell, RebindableSyntax #-}
+import Prelude
import T18102b_aux
-x :: Int
-x = $$(intQuote)
+x1 :: Int
+x1 = $$(intQuote_TTH)
+
+z1 :: Int
+z1 = $(intQuote_TH)
+
+x2 :: Char
+x2 = $$(charQuote_TTH)
+
+z2 :: Char
+z2 = $(charQuote_TH)
+
+x3 :: [Int]
+x3 = $$(seqQuote_TTH)
+
+z3 :: [Int]
+z3 = $(seqQuote_TH)
+
+x4 :: [Int]
+x4 = $$(listQuote_TTH)
+
+z4 :: [Int]
+z4 = $(listQuote_TH)
+
main :: IO ()
-main = print x
+main = do
+ print t1
+ print x1
+ print z1
+
+ print t2
+ print x2
+ print z2
+
+ print t3
+ print x3
+ print z3
+
+ print t4
+ print x4
+ print z4
=====================================
testsuite/tests/th/T18102b_aux.hs
=====================================
@@ -1,11 +1,60 @@
-{-# LANGUAGE RebindableSyntax, TemplateHaskell #-}
+{-# LANGUAGE RebindableSyntax, TemplateHaskell, OverloadedLists #-}
module T18102b_aux where
-import Prelude
+import Prelude hiding ((>>=), return )
import Language.Haskell.TH.Syntax
+
+
ifThenElse :: Bool -> Int -> Int -> Int
ifThenElse _ a b = a+b
-intQuote :: Code Q Int
-intQuote = [|| if True then 10 else 15 ||]
+intQuote_TTH :: Code Q Int
+intQuote_TTH = [|| if True then 10 else 15 ||]
+
+intQuote_TH :: Quote m => m Exp
+intQuote_TH = [| if True then 10 else 15 |]
+
+t1 :: Int
+t1 = if True then 10 else 15
+
+
+(>>=) :: a -> ((forall b . b) -> c) -> c
+a >>= f = f undefined
+return _ = 'b'
+fail s = undefined
+
+t2 :: Char
+t2 = do { return 'k' }
+
+charQuote_TTH :: Code Q Char
+charQuote_TTH = [|| do { return 'k' } ||]
+
+charQuote_TH :: Quote m => m Exp
+charQuote_TH = [| do { return 'k' } |]
+
+fromListN :: Int -> [Int] -> [Int]
+fromListN _ l = replicate (length l) (length l)
+
+fromList :: [Int] -> [Int]
+fromList x = replicate (length x) (length x)
+
+
+t3 :: [Int]
+t3 = [2..7]
+
+seqQuote_TTH :: Code Q [Int]
+seqQuote_TTH = [|| [2..7] ||]
+
+seqQuote_TH :: Quote m => m Exp
+seqQuote_TH = [| [2..7] |]
+
+
+t4 :: [Int]
+t4 = [1,2,3]
+
+listQuote_TTH :: Code Q [Int]
+listQuote_TTH = [|| [1,2,3] ||]
+
+listQuote_TH :: Quote m => m Exp
+listQuote_TH = [| [1,2,3] |]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fb071d3919c96382b2770649389f7be046379fb8
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fb071d3919c96382b2770649389f7be046379fb8
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help