Commit 850e0b31 authored by sewardj's avatar sewardj
Browse files

[project @ 2001-06-26 11:31:20 by sewardj]

Add the parser tests, formerly known as reader/.  Contains a significant
amount of breakage which needs to be looked at.
parent 172201a4
include ($confdir ++ "/../vanilla-test.T")
-- Args to vtc are: extra compile flags
test "read001" { vtc("") }
test "read002" { vtc("") }
test "read003" { vtc("") }
test "read004" { vtc("") }
test "read005" { vtc("") }
test "read006" { vtc("") }
test "read007" { vtc("") }
test "read008" { vtc("") }
test "read009" { vtc("") }
test "read010" { vtc("") }
test "read011" { vtc("") }
test "read012" { vtc("-O -funfold-casms-in-hi-file -fglasgow-exts -ohi T1.hi") }
test "read013" { vtc("-O -funfold-casms-in-hi-file -fglasgow-exts") }
test "read014" { vtc("-Wall") }
test "read015" { vtc("") }
test "read016" { vtc("") }
test "read017" { vtc("") }
test "read018" { vtc("") }
test "read019" { vtc("") }
test "read020" { vtc("") }
test "read021" { vtc("") }
test "read022" { vtc("-fglasgow-exts") }
test "read023" { vtc("") }
test "read024" { vtc("-fglasgow-exts") }
test "read025" { vtc("") }
test "read026" { vtc("") }
test "read027" { vtc("") }
test "read028" { vtc("") }
test "read029" { vtc("") }
test "read030" { vtc("") }
-- !!! import qualified Prelude should leave (), [] etc in scope
module ShouldCompile where
import qualified Prelude
f :: Prelude.IO ()
f = Prelude.return ()
-- !!! 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
-- !!! Testing layout rule
module ShouldCompile where
l1 :: IO ()
l1 = do
return a
where
a = ()
l2 :: IO ()
l2 = do
return a
where
a = ()
l3 :: IO ()
l3 = do
return a
where
a = ()
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!
module ShouldCompile where
-- !!! Empty comments terminating a file..
main = print "Hello" --
-- !!! Testing handling of troublesome constructor name (:::)
module MyList (MyList(Empty, (:::))) where
data MyList a = Empty
| (MyList a) ::: (MyList a)
module ShouldCompile where
import MyList
myLength :: MyList a -> Int
myLength Empty = 0
myLength (x ::: xs) = 1 + myLength xs
module ShouldCompile where
{-# SPECIALISE f :: Int -> Int #-}
f n = n + 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
-- !!! Infix record constructor.
module ShouldCompile where
data Rec = (:<-:) { a :: Int, b :: Float }
-- !!! 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]
module T1 where
malloc :: IO Int
malloc = _casm_ ``%r = 42;''
module T2 where
import T1
blah :: IO Int
blah = malloc
-- !!! 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
read014.hs:4: Warning: Definition but no type signature for `ng1'
read014.hs:4: Warning: Defined but not used: x
read014.hs:8: Warning: Defined but not used: x
read014.hs:6:
Warning: No explicit method nor default method for `*'
in an instance declaration for `Num'
read014.hs:6:
Warning: No explicit method nor default method for `+'
in an instance declaration for `Num'
read014.hs:6:
Warning: No explicit method nor default method for `signum'
in an instance declaration for `Num'
read014.hs:6:
Warning: No explicit method nor default method for `abs'
in an instance declaration for `Num'
read014.hs:6:
Warning: No explicit method nor default method for `fromInteger'
in an instance declaration for `Num'
-- !!! Testing whether the parser likes empty declarations..
module ShouldCompile where { ;;;;;x=let{;;;;;y=2;;;;}in y;;;;;}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment