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

Commits:

4 changed files:

Changes:

  • compiler/GHC/Rename/Expr.hs
    ... ... @@ -46,7 +46,6 @@ import GHC.Driver.DynFlags
    46 46
     import GHC.Builtin.KnownKeys
    
    47 47
     import GHC.Builtin.KnownOccs
    
    48 48
     import GHC.Builtin.WiredIn.Types ( nilDataConName, oneDataConName )
    
    49
    -import GHC.Builtin.WiredIn.Ids( rightSectionName, leftSectionName )
    
    50 49
     
    
    51 50
     import GHC.Unit.Module ( isInteractiveModule )
    
    52 51
     
    
    ... ... @@ -74,7 +73,7 @@ import qualified GHC.LanguageExtensions as LangExt
    74 73
     import Control.Monad
    
    75 74
     import qualified Data.Foldable as Partial (maximum)
    
    76 75
     import Data.List (unzip4)
    
    77
    -import Data.List.NonEmpty ( NonEmpty(..), head, init, last, nonEmpty, scanl, tail )
    
    76
    +import Data.List.NonEmpty ( NonEmpty(..), head, nonEmpty, scanl, tail )
    
    78 77
     import Data.Ord
    
    79 78
     import Data.Array
    
    80 79
     import GHC.Driver.Env (HscEnv)
    

  • testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
    1 1
     RecordDotSyntaxFail8.hs:47:17: error: [GHC-39999]
    
    2 2
         • No instance for ‘HasField "quux1" Quux Quux’
    
    3
    -	arising from selecting the field ‘quux1’
    
    4
    -      NB: ‘HasField’ is not the built-in ‘GHC.Internal.Records.HasField’ class.
    
    3
    +        arising from selecting the field ‘quux1’
    
    4
    +      NB: ‘HasField’ is not the built-in ‘HasField’ class.
    
    5 5
         • In the second argument of ‘($)’, namely ‘a.foo.bar.baz.quux1’
    
    6 6
           In a stmt of a 'do' block: print @Quux $ a.foo.bar.baz.quux1
    
    7 7
           In the expression:
    
    8
    -	do let a = Foo {foo = ...}
    
    9
    -	   print @Quux $ ....bar.baz.quux1
    
    10
    -	   let b = myQuux
    
    11
    -	   print @Quux $ b.quux2
    
    12
    -	   let c = Foo {foo = ...}
    
    13
    -	   ...
    
    8
    +        do let a = Foo {foo = ...}
    
    9
    +           print @Quux $ ....bar.baz.quux1
    
    10
    +           let b = myQuux
    
    11
    +           print @Quux $ b.quux2
    
    12
    +           let c = Foo {foo = ...}
    
    13
    +           ...
    
    14 14
     
    
    15 15
     RecordDotSyntaxFail8.hs:50:17: error: [GHC-39999]
    
    16 16
         • No instance for ‘HasField "quux2" Quux Quux’
    
    17
    -	arising from selecting the field ‘quux2’
    
    17
    +        arising from selecting the field ‘quux2’
    
    18 18
           NB: ‘HasField’ is not the built-in ‘HasField’ class.
    
    19 19
         • In the second argument of ‘($)’, namely ‘b.quux2’
    
    20 20
           In a stmt of a 'do' block: print @Quux $ b.quux2
    
    21 21
           In the expression:
    
    22
    -	do let a = Foo {foo = ...}
    
    23
    -	   print @Quux $ ....bar.baz.quux1
    
    24
    -	   let b = myQuux
    
    25
    -	   print @Quux $ b.quux2
    
    26
    -	   let c = Foo {foo = ...}
    
    27
    -	   ...
    
    22
    +        do let a = Foo {foo = ...}
    
    23
    +           print @Quux $ ....bar.baz.quux1
    
    24
    +           let b = myQuux
    
    25
    +           print @Quux $ b.quux2
    
    26
    +           let c = Foo {foo = ...}
    
    27
    +           ...
    
    28 28
     
    
    29 29
     RecordDotSyntaxFail8.hs:53:17: error: [GHC-39999]
    
    30 30
         • No instance for ‘HasField "quux3" Quux r0’
    
    31
    -	arising from selecting the field ‘quux3’
    
    32
    -      NB: ‘HasField’ is not the built-in ‘GHC.Internal.Records.HasField’ class.
    
    31
    +        arising from selecting the field ‘quux3’
    
    32
    +      NB: ‘HasField’ is not the built-in ‘HasField’ class.
    
    33 33
         • In the second argument of ‘($)’, namely ‘a.foo.bar.baz.quux3.wob’
    
    34 34
           In a stmt of a 'do' block: print @Bool $ a.foo.bar.baz.quux3.wob
    
    35 35
           In the expression:
    
    36
    -	do let a = Foo {foo = ...}
    
    37
    -	   print @Quux $ ....bar.baz.quux1
    
    38
    -	   let b = myQuux
    
    39
    -	   print @Quux $ b.quux2
    
    40
    -	   let c = Foo {foo = ...}
    
    41
    -	   ...
    36
    +        do let a = Foo {foo = ...}
    
    37
    +           print @Quux $ ....bar.baz.quux1
    
    38
    +           let b = myQuux
    
    39
    +           print @Quux $ b.quux2
    
    40
    +           let c = Foo {foo = ...}
    
    41
    +           ...
    
    42
    +

  • testsuite/tests/th/T18102b.hs
    1
    -{-# LANGUAGE TemplateHaskell, RebindableSyntax #-}
    
    1
    +{-# LANGUAGE TemplateHaskell #-}
    
    2 2
     
    
    3
    -import Prelude
    
    4 3
     import T18102b_aux
    
    5 4
     
    
    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
    -
    
    5
    +x :: Int
    
    6
    +x = $$(intQuote)
    
    30 7
     
    
    31 8
     main :: IO ()
    
    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
    9
    +main = print x

  • testsuite/tests/th/T18102b_aux.hs
    1
    -{-# LANGUAGE RebindableSyntax, TemplateHaskell, OverloadedLists #-}
    
    1
    +{-# LANGUAGE RebindableSyntax, TemplateHaskell #-}
    
    2 2
     module T18102b_aux where
    
    3 3
     
    
    4
    -import Prelude hiding ((>>=), return )
    
    4
    +import Prelude
    
    5 5
     import Language.Haskell.TH.Syntax
    
    6 6
     
    
    7
    -
    
    8
    -
    
    9 7
     ifThenElse :: Bool -> Int -> Int -> Int
    
    10 8
     ifThenElse _ a b = a+b
    
    11 9
     
    
    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] |]
    10
    +intQuote :: Code Q Int
    
    11
    +intQuote = [|| if True then 10 else 15 ||]