Apoorv Ingle pushed to branch wip/ani/T27156 at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • compiler/GHC/Rename/Expr.hs
    ... ... @@ -3,6 +3,7 @@
    3 3
     {-# LANGUAGE MultiWayIf          #-}
    
    4 4
     {-# LANGUAGE TypeFamilies        #-}
    
    5 5
     {-# LANGUAGE ViewPatterns        #-}
    
    6
    +{-# LANGUAGE RecordWildCards     #-}
    
    6 7
     
    
    7 8
     {-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
    
    8 9
     
    
    ... ... @@ -351,8 +352,9 @@ rnExpr (HsOverLit x lit)
    351 352
     
    
    352 353
     rnExpr (HsQualLit x QualLit{..})
    
    353 354
      = do { (funName, fvs) <- lookupNameWithQualifier fromStringName ql_mod
    
    354
    -      ; let lit' = QualLit{ql_ext = L noAnn funName, ..}
    
    355
    -      ; return (HsQualLit x lit', fvs)
    
    355
    +      ; let ql_val' = case ql_val of
    
    356
    +                        HsQualString st s -> HsQualString st s
    
    357
    +      ; return (HsQualLit x (QualLit (L noAnn funName) ql_mod ql_val'), fvs)
    
    356 358
           }
    
    357 359
     
    
    358 360
     rnExpr (HsApp x fun arg)
    

  • compiler/GHC/Tc/Gen/Expand.hs
    ... ... @@ -21,7 +21,7 @@ import GHC.Types.Name
    21 21
     import GHC.Types.Name.Reader
    
    22 22
     import GHC.Types.Id.Make
    
    23 23
     import GHC.Types.SrcLoc
    
    24
    -import GHC.Types.SourceText ( mkIntegralLit , SourceText(..) )
    
    24
    +import GHC.Types.SourceText ( SourceText(..) )
    
    25 25
     
    
    26 26
     import GHC.Builtin.Names
    
    27 27
     
    

  • testsuite/tests/ghc-api/T25121_status.stdout
    ... ... @@ -45,7 +45,7 @@ X(ExprWithTySig) mismatch
    45 45
       <<< EpUniToken "::" "\8759"
    
    46 46
     X(UntypedSplice) mismatch
    
    47 47
       >>> HsUntypedSpliceResult (HsExpr (GhcPass 'Renamed))
    
    48
    -  <<< HsUntypedSpliceResult (GenLocated (EpAnn AnnListItem) (HsType (GhcPass 'Renamed)))
    
    48
    +  <<< HsUntypedSpliceResult (GenLocated (EpAnn [TrailingAnn]) (HsType (GhcPass 'Renamed)))
    
    49 49
     X(ExplicitList) mismatch
    
    50 50
       >>> RebindableSyntaxTable
    
    51 51
       <<< NoExtField
    

  • testsuite/tests/th/T18102b.hs
    1
    -{-# LANGUAGE TemplateHaskell #-}
    
    1
    +{-# LANGUAGE TemplateHaskell, RebindableSyntax #-}
    
    2 2
     
    
    3
    +import Prelude
    
    3 4
     import T18102b_aux
    
    4 5
     
    
    5
    -x :: Int
    
    6
    -x = $$(intQuote)
    
    6
    +x1 :: Int
    
    7
    +x1 = $$(intQuote_TTH)
    
    8
    +
    
    9
    +z1 :: Int
    
    10
    +z1 = $(intQuote_TH)
    
    11
    +
    
    12
    +x2 :: Char
    
    13
    +x2 = $$(charQuote_TTH)
    
    14
    +
    
    15
    +z2 :: Char
    
    16
    +z2 = $(charQuote_TH)
    
    17
    +
    
    18
    +x3 :: [Int]
    
    19
    +x3 = $$(seqQuote_TTH)
    
    20
    +
    
    21
    +z3 :: [Int]
    
    22
    +z3 = $(seqQuote_TH)
    
    23
    +
    
    24
    +x4 :: [Int]
    
    25
    +x4 = $$(listQuote_TTH)
    
    26
    +
    
    27
    +z4 :: [Int]
    
    28
    +z4 = $(listQuote_TH)
    
    29
    +
    
    7 30
     
    
    8 31
     main :: IO ()
    
    9
    -main = print x
    32
    +main = do
    
    33
    +  print t1
    
    34
    +  print x1
    
    35
    +  print z1
    
    36
    +
    
    37
    +  print t2
    
    38
    +  print x2
    
    39
    +  print z2
    
    40
    +
    
    41
    +  print t3
    
    42
    +  print x3
    
    43
    +  print z3
    
    44
    +
    
    45
    +  print t4
    
    46
    +  print x4
    
    47
    +  print z4

  • testsuite/tests/th/T18102b_aux.hs
    1
    -{-# LANGUAGE RebindableSyntax, TemplateHaskell #-}
    
    1
    +{-# LANGUAGE RebindableSyntax, TemplateHaskell, OverloadedLists #-}
    
    2 2
     module T18102b_aux where
    
    3 3
     
    
    4
    -import Prelude
    
    4
    +import Prelude hiding ((>>=), return )
    
    5 5
     import Language.Haskell.TH.Syntax
    
    6 6
     
    
    7
    +
    
    8
    +
    
    7 9
     ifThenElse :: Bool -> Int -> Int -> Int
    
    8 10
     ifThenElse _ a b = a+b
    
    9 11
     
    
    10
    -intQuote :: Code Q Int
    
    11
    -intQuote = [|| if True then 10 else 15 ||]
    12
    +intQuote_TTH :: Code Q Int
    
    13
    +intQuote_TTH = [|| if True then 10 else 15 ||]
    
    14
    +
    
    15
    +intQuote_TH :: Quote m => m Exp
    
    16
    +intQuote_TH = [| if True then 10 else 15 |]
    
    17
    +
    
    18
    +t1 :: Int
    
    19
    +t1 = if True then 10 else 15
    
    20
    +
    
    21
    +
    
    22
    +(>>=) :: a -> ((forall b . b) -> c) -> c
    
    23
    +a >>= f = f undefined
    
    24
    +return _ = 'b'
    
    25
    +fail s = undefined
    
    26
    +
    
    27
    +t2 :: Char
    
    28
    +t2 = do { return 'k' }
    
    29
    +
    
    30
    +charQuote_TTH :: Code Q Char
    
    31
    +charQuote_TTH = [|| do { return 'k' } ||]
    
    32
    +
    
    33
    +charQuote_TH :: Quote m => m Exp
    
    34
    +charQuote_TH = [| do { return 'k' } |]
    
    35
    +
    
    36
    +fromListN :: Int -> [Int] -> [Int]
    
    37
    +fromListN _ l = replicate (length l) (length l)
    
    38
    +
    
    39
    +fromList  :: [Int] -> [Int]
    
    40
    +fromList x = replicate (length x) (length x)
    
    41
    +
    
    42
    +
    
    43
    +t3 :: [Int]
    
    44
    +t3 = [2..7]
    
    45
    +
    
    46
    +seqQuote_TTH :: Code Q [Int]
    
    47
    +seqQuote_TTH = [|| [2..7] ||]
    
    48
    +
    
    49
    +seqQuote_TH :: Quote m => m Exp
    
    50
    +seqQuote_TH = [| [2..7] |]
    
    51
    +
    
    52
    +
    
    53
    +t4 :: [Int]
    
    54
    +t4 = [1,2,3]
    
    55
    +
    
    56
    +listQuote_TTH :: Code Q [Int]
    
    57
    +listQuote_TTH = [|| [1,2,3] ||]
    
    58
    +
    
    59
    +listQuote_TH :: Quote m => m Exp
    
    60
    +listQuote_TH = [| [1,2,3] |]