[import ghc parsing regression tests
John Meacham <john@repetae.net>**20100811002607
 Ignore-this: 7a3676c7655fe26c52dd7eddd3c356dc
] adddir ./regress/tests/0_parse/2_pass/ghc
addfile ./regress/tests/0_parse/2_pass/ghc/T3741.hs
addfile ./regress/tests/0_parse/2_pass/ghc/config.yaml
addfile ./regress/tests/0_parse/2_pass/ghc/read001.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read002.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read004.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read005.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read008.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read009.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read010.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read011.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read014.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read015.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read016.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read017.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read018.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read019.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read021.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read022.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read023.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read024.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read025.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read026.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read028.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read029.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read030.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read031.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read032.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read033.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read034.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read036.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read037.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read038.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read039.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read040.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read042.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read043.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read044.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read045.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read048.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read049.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read050.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read054.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read056.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read057.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read058.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read060.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read061.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read062.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read064.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read066.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read067.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read068.hs
addfile ./regress/tests/0_parse/2_pass/ghc/read_1821.hs
hunk ./regress/tests/0_parse/2_pass/ghc/T3741.hs 1
+笑 :: Int
+笑 = 3
+
+main = print 笑
hunk ./regress/tests/0_parse/2_pass/ghc/config.yaml 1
+tests:
+    read028:
+        skip: known_bug
+    read030:
+        skip: known_bug
+    read042:
+        skip: BangPatterns
+    read050:
+        skip: KindSignatures
+    read054:
+        skip: ParallelListComp
+    read058:
+        skip: RecursiveDo
+    read062:
+        skip: TransformListComp
hunk ./regress/tests/0_parse/2_pass/ghc/read001.hs 1
+-- !!! import qualified Prelude should leave (), [] etc in scope
+
+module ShouldCompile where
+
+import qualified Prelude
+
+f :: Prelude.IO ()
+f = Prelude.return ()
hunk ./regress/tests/0_parse/2_pass/ghc/read002.hs 1
+-- !!! tests fixity reading and printing
+module ShouldCompile where
+
+infixl 1 `f`
+infixr 2 \\\
+infix  3 :==>
+infix  4 `MkFoo`
+
+data Foo = MkFoo Int | Float :==> Double
+
+x `f` y = x
+
+(\\\) :: (Eq a) => [a] -> [a] -> [a]
+(\\\) xs ys =  xs
hunk ./regress/tests/0_parse/2_pass/ghc/read004.hs 1
+module ShouldCompile where
+
+{-
+From: Kevin Hammond <kh>
+To: partain
+Subject: Re:  parsing problem w/ queens
+Date: Wed, 9 Oct 91 17:31:46 BST
+
+OK, I've fixed that little problem by disallowing,
+-}
+
+f x = x + if True then 1 else 2
+g x = x + 1::Int
+
+-- (the conditional/sig need to be parenthesised).  If this is
+-- problematic, let me know!
hunk ./regress/tests/0_parse/2_pass/ghc/read005.hs 1
+module ShouldCompile where
+
+-- !!! Empty comments terminating a file..
+main = print "Hello" --
hunk ./regress/tests/0_parse/2_pass/ghc/read008.hs 1
+module ShouldCompile where
+
+{-# SPECIALISE f :: Int -> Int #-}
+f n = n + 1
hunk ./regress/tests/0_parse/2_pass/ghc/read009.hs 1
+-- !!! combining undeclared infix operators
+module ShouldCompile where
+
+-- should default to 'infixl 9'
+
+test = let f x y = x+y in 1 `f` 2 `f` 3
+
hunk ./regress/tests/0_parse/2_pass/ghc/read010.hs 1
+-- !!! Infix record constructor.
+module ShouldCompile where
+
+data Rec = (:<-:) { a :: Int, b :: Float }
hunk ./regress/tests/0_parse/2_pass/ghc/read011.hs 1
+-- !!! do & where interaction
+module ShouldCompile where
+
+f1 :: IO a -> IO [a]
+f1 x = do
+  v <- x
+  return [v]
+ where
+  g x = [x,x]
+
+f2 :: IO a -> IO [a]
+f2 x = do
+  v <- x
+  return (g v)
+   where
+    g x = [x,x]
+
+f3 :: IO a -> IO [a]
+f3 x = do
+  v <- x
+  return (g v)
+  where
+   g x = [x,x]
+
hunk ./regress/tests/0_parse/2_pass/ghc/read014.hs 1
+-- !!! Empty export lists are legal (and useful.)
+module ShouldCompile () where
+
+ng1 x y = negate y
+
+instance (Num a, Num b) => Num (a,b)
+  where
+   negate (a,b) = (ng 'c' a, ng1 'c' b)   where  ng x y = negate y
hunk ./regress/tests/0_parse/2_pass/ghc/read015.hs 1
+-- !!! Testing whether the parser likes empty declarations..
+module ShouldCompile where { ;;;;;x=let{;;;;;y=2;;;;}in y;;;;;}
hunk ./regress/tests/0_parse/2_pass/ghc/read016.hs 1
+-- !!! Checking that both import lists and 'hiding' lists might
+-- !!! be empty.
+module ShouldCompile where
+
+import List  ()
+import List  hiding ()
+
+x :: Int
+x = 1
+
hunk ./regress/tests/0_parse/2_pass/ghc/read017.hs 1
+-- !!! Checking that empty declarations are permitted.
+module ShouldCompile where
+
+
+class Foo a where
+
+class Foz a
+
+x = 2 where 
+y = 3
+
+instance Foo Int where
+
+f = f where g = g where
+type T = Int
hunk ./regress/tests/0_parse/2_pass/ghc/read018.hs 1
+-- !!! Checking that empty contexts are permitted.
+module ShouldCompile where
+
+data () => Foo a = Foo a
+
+newtype () => Bar = Bar Int
+
+f :: () => Int -> Int
+f = (+1)
+
+
+class () => Fob a where
+
+instance () => Fob Int where
+instance () => Fob Float
+
hunk ./regress/tests/0_parse/2_pass/ghc/read019.hs 1
+-- !!! Checking what's legal in the body of a class declaration.
+module ShouldCompile where
+
+class Foo a where {
+  (--<>--) :: a -> a -> Int  ;
+  infixl 5 --<>-- ;
+  (--<>--) _ _ = 2 ; -- empty decl at the end.
+};
+
+
hunk ./regress/tests/0_parse/2_pass/ghc/read021.hs 1
+-- !!! Empty export list
+
+module ShouldCompile() where
+
+instance Show (a->b) where
+  show f = "<<function>>"
hunk ./regress/tests/0_parse/2_pass/ghc/read022.hs 1
+module ShouldCompile where
+
+f (x :: Int) = x + 1
hunk ./regress/tests/0_parse/2_pass/ghc/read023.hs 1
+module ShouldCompile where
+
+-- M.<keyword> isn't a qualified identifier
+f  = Just.let x=id in x
+
+-- ---------------------------------------------------------------------------
+-- we changed the behaviour of this one in GHC, but the following test
+-- is strictly speaking legal Haskell:
+
+-- f' = Just.\1 where (.\) = ($)
+
+-- -----------------------------------------------------
+-- M.{as,hiding,qualified} *are* qualified identifiers:
+
+g  = ShouldCompile.as
+
+-- ---------------------------------------------------------------------------
+-- special symbols (!, -) can be qualified to make varids.
+
+g' = (ShouldCompile.!)
+
+as x = x
+(!) x = x
hunk ./regress/tests/0_parse/2_pass/ghc/read024.hs 1
+-- !!! checking that special ids are correctly handled.
+module ShouldCompile where
+
+as :: [as]
+as = [head as]
+
+qualified :: [qualified]
+qualified = [head qualified]
+
+hiding :: [hiding]
+hiding = [head hiding]
+
+export :: [export]
+export = [head export]
+
+label :: [label]
+label = [head label]
+
+dynamic :: [dynamic]
+dynamic = [head dynamic]
+
+unsafe :: [unsafe]
+unsafe = [head unsafe]
+
+stdcall :: [stdcall]
+stdcall = [head stdcall]
+
+ccall :: [ccall]
+ccall = [head ccall]
+
hunk ./regress/tests/0_parse/2_pass/ghc/read025.hs 1
+-- !!! Check the handling of 'qualified' and 'as' clauses
+module ShouldCompile where
+
+import List as L ( intersperse ) 
+
+x = L.intersperse
+
+y = intersperse
+
hunk ./regress/tests/0_parse/2_pass/ghc/read026.hs 1
+module ShouldCompile where
+
+(<>)          :: (a -> Maybe b) -> (b -> Maybe c) -> (a -> Maybe c)
+(m1 <> m2) a1	=  case m1 a1 of
+                      Nothing -> Nothing
+                      Just a2 -> m2 a2
hunk ./regress/tests/0_parse/2_pass/ghc/read028.hs 1
+module ShouldCompile where
+
+data T a b = (:^:) a b
hunk ./regress/tests/0_parse/2_pass/ghc/read029.hs 1
+-- !!! Special Ids and ops
+
+-- The special ids 'as', 'qualified' and 'hiding' should be 
+-- OK in both qualified and unqualified form.
+-- Ditto special ops
+
+module ShouldCompile where
+import Prelude hiding ( (-) )
+
+as	  = ShouldCompile.as
+hiding	  = ShouldCompile.hiding
+qualified = ShouldCompile.qualified
+x!y	  = x ShouldCompile.! y
+x-y	  = x ShouldCompile.- y
hunk ./regress/tests/0_parse/2_pass/ghc/read030.hs 1
+-- !!! Infix decls w/ infix data constructors
+
+-- GHC used to barf on this...
+
+module ShouldCompile where
+
+infix 2 |-, |+
+
+ps  |-  q:qs   = undefined
+ps  |+  p:q:qs = undefined
hunk ./regress/tests/0_parse/2_pass/ghc/read031.hs 1
+-- !!! "--" can start a legal lexeme 
+
+module ShouldCompile where
+
+infix 2 --+, -->
+
+ps  -->  True   = True
+
+(--+) a b = a && b 
+
hunk ./regress/tests/0_parse/2_pass/ghc/read032.hs 1
+module ShouldCompile where
+
+-- !!! Record declarations with zero fields are allowed
+data Foo = Foo{}
hunk ./regress/tests/0_parse/2_pass/ghc/read033.hs 1
+module ShouldCompile where
+
+x = const 1.0e+x where e = 3
hunk ./regress/tests/0_parse/2_pass/ghc/read034.hs 1
+module ShouldCompile where
+
+-- !!! Section precedences
+
+-- infixl 6  +, -
+-- infixr 5  ++, :
+
+f = (++ [] ++ [])
+g = (3 + 4 +)
+
+-- prefix negation is like infixl 6.
+h x = (-x -)
hunk ./regress/tests/0_parse/2_pass/ghc/read036.hs 1
+module ShouldCompile where
+
+f :: Double
+f = 42e42  -- this should be a float
hunk ./regress/tests/0_parse/2_pass/ghc/read037.hs 1
+module ShouldCompile where
+
+-- This file contains several non-breaking space characters,
+-- aka '\xa0'.  The compiler should recognise these as whitespace.
+                          
+f = ( + ) 
hunk ./regress/tests/0_parse/2_pass/ghc/read038.hs 1
+module ShouldCompile where
+a ---> b = a + a
+foo = 3
+ ---> 4
+ ---> 5
hunk ./regress/tests/0_parse/2_pass/ghc/read039.hs 1
+{-# LANGUAGE ForeignFunctionInterface, CPP #-}
+-- Test the LANGUAGE pragma
+module ShouldCompile where
+
+#if 1
+foreign import ccall "foo" foo :: Int -> IO Int
+#endif
hunk ./regress/tests/0_parse/2_pass/ghc/read040.hs 1
+{-# OPTIONS -fglasgow-exts #-}
+
+-- A type signature on the LHS of a do-stmt was a parse
+-- error in 6.4.2, but ok thereafter
+
+module ShouldCompile where
+
+f () = do { x :: Bool <- return True 
+	  ; return x }
hunk ./regress/tests/0_parse/2_pass/ghc/read042.hs 1
+{-# OPTIONS -XBangPatterns #-}
+
+-- Various bang-pattern and lazy-pattern tests
+
+module ShouldCompile where
+
+main1,main2,main3,main4,main5,main6,main7 :: IO ()
+
+main1 = do
+    !c <- return ()
+    return ()
+
+main2 = return () >>= \ !c -> return ()
+
+main3 = do
+    (!c) <- return ()
+    return ()
+
+main4 = return () >>= \ (!c) -> return ()
+
+main5 = let !x = 1 in return ()
+
+main6 = do
+    ~c <- return ()
+    return ()
+
+main7 = return () >>= \ ~c -> return ()
+
+
hunk ./regress/tests/0_parse/2_pass/ghc/read043.hs 1
+
+{-# OPTIONS -fwarn-tabs #-}
+
+-- Check we get a warning for tabs
+
+module ShouldCompile where
+
+tab1	= 'a'
+notab   = 'b'
+tab2	= 'c'
+
hunk ./regress/tests/0_parse/2_pass/ghc/read044.hs 1
+-- test case from #1091
+main =
+ 	  case True of {- | -}
+ 	    True  -> putStrLn "Hello World\n"
+ 	    False {- | -} -> putStrLn "Goodbye Cruel World\n"
hunk ./regress/tests/0_parse/2_pass/ghc/read045.hs 1
+{
+main =
+putStr "hello";
+}
hunk ./regress/tests/0_parse/2_pass/ghc/read048.hs 1
+
+{-# OPTIONS_GHC -XEmptyDataDecls #-}
+
+module Foo where
+
+data Foo
+
hunk ./regress/tests/0_parse/2_pass/ghc/read049.hs 1
+
+{-# LANGUAGE EmptyDataDecls #-}
+
+module Foo where
+
+data Foo
+
hunk ./regress/tests/0_parse/2_pass/ghc/read050.hs 1
+
+{-# OPTIONS_GHC -XKindSignatures #-}
+
+module Foo where
+
+data Foo (a :: *) = Foo a
+
hunk ./regress/tests/0_parse/2_pass/ghc/read054.hs 1
+
+{-# OPTIONS_GHC -XParallelListComp #-}
+
+module Foo where
+
+foo = [ ()
+      | () <- foo
+      | () <- foo
+      ]
+
hunk ./regress/tests/0_parse/2_pass/ghc/read056.hs 1
+
+{-# OPTIONS_GHC -XGeneralizedNewtypeDeriving #-}
+
+module Foo where
+
+class C a
+instance C Int
+
+newtype Foo = Foo Int
+    deriving C
+
hunk ./regress/tests/0_parse/2_pass/ghc/read057.hs 1
+
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
+module Foo where
+
+class C a
+instance C Int
+
+newtype Foo = Foo Int
+    deriving C
+
hunk ./regress/tests/0_parse/2_pass/ghc/read058.hs 1
+
+{-# OPTIONS_GHC -XRecursiveDo #-}
+
+module Foo where
+
+import Control.Monad.Fix
+
+z :: Maybe [Int]
+z = mdo x <- return (1:x)
+        return (take 4 x)
+
hunk ./regress/tests/0_parse/2_pass/ghc/read060.hs 1
+
+{-# OPTIONS_GHC -XFunctionalDependencies #-}
+{-# OPTIONS_GHC -XMultiParamTypeClasses #-}
+
+module Foo where
+
+class Foo a b | a -> b
+
hunk ./regress/tests/0_parse/2_pass/ghc/read061.hs 1
+
+{-# LANGUAGE FunctionalDependencies #-}
+{-# OPTIONS_GHC -XMultiParamTypeClasses #-}
+
+module Foo where
+
+class Foo a b | a -> b
+
hunk ./regress/tests/0_parse/2_pass/ghc/read062.hs 1
+{-# OPTIONS_GHC -XTransformListComp #-}
+
+module Foo where
+
+import List
+import GHC.Exts
+
+foo = [ ()
+      | x <- [1..10]
+      , then take 5
+      , then sortWith by x
+      , then group by x
+      , then group using inits
+      , then group by x using groupWith
+      ]
+
hunk ./regress/tests/0_parse/2_pass/ghc/read064.hs 1
+
+module Foo where
+
+{-# THISISATYPO foo #-}
+foo :: ()
+foo = ()
+
hunk ./regress/tests/0_parse/2_pass/ghc/read066.hs 1
+
+{-# OPTIONS_NO_SUCH_PRAGMA --no-such-flag #-}
+
+-- We should parse the above as an unrecognised pragma, not as an OPTIONS
+-- pragma containing "_NO_SUCH_PRAGMA -wibble". Trac #2847.
+
+module Test where
+
hunk ./regress/tests/0_parse/2_pass/ghc/read067.hs 1
+
+{-# OPTIONS_HUGS --some-hugs-flag #-}
+
+-- We should ignore the above pragma, as we recognise that it is
+-- hugs-specific. We shouldn't even warn about it.
+
+module Test where
+
hunk ./regress/tests/0_parse/2_pass/ghc/read068.hs 1
+-- Test for trac #3079 - parsing fails if a LANGUAGE pragma straddles
+-- a 1024 byte boundary.
+-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+-- xxxxxxxxxxxxxxxxxxxxxxx
+-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+--
+--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+{-# LANGUAGE NoImplicitPrelude #-}
+
+import Prelude
+
+main :: IO ()
+main = return ()
+
hunk ./regress/tests/0_parse/2_pass/ghc/read_1821.hs 1
+
+-- Trac #1821
+
+module Par where
+
+f x = x
+  where
+-- ######### x86_64 machine code:
+    g y = y
+    h y = y