From cedd20d43966d4fdf2e50a71e807693e14127937 Mon Sep 17 00:00:00 2001 From: simonpj Date: Wed, 10 Feb 1999 15:46:06 +0000 Subject: [PATCH] [project @ 1999-02-10 15:45:52 by simonpj] Misc tests fixes, and activate the programs directory --- ghc/tests/Makefile | 4 +- ghc/tests/programs/Makefile | 10 ++- ghc/tests/programs/fast2haskell/Fast2haskell.hs | 16 ++-- ghc/tests/programs/jon_polycase/Foo.lhs | 4 +- ghc/tests/reader/should_fail/expr001.stderr | 7 +- ghc/tests/reader/should_fail/read001.stderr | 93 +++++++++++----------- ghc/tests/reader/should_fail/read003.stderr | 8 +- ghc/tests/reader/should_fail/read006.stderr | 2 +- ghc/tests/rename/should_compile/rn017.stderr | 4 +- ghc/tests/rename/should_fail/rnfail001.stderr | 6 +- ghc/tests/rename/should_fail/rnfail002.stderr | 2 +- ghc/tests/rename/should_fail/rnfail003.stderr | 2 +- ghc/tests/rename/should_fail/rnfail004.stderr | 12 ++- ghc/tests/rename/should_fail/rnfail007.stderr | 5 +- ghc/tests/rename/should_fail/rnfail008.stderr | 4 +- ghc/tests/rename/should_fail/rnfail009.stderr | 2 +- ghc/tests/rename/should_fail/rnfail010.stderr | 2 +- ghc/tests/rename/should_fail/rnfail011.stderr | 2 +- ghc/tests/rename/should_fail/rnfail012.stderr | 2 +- ghc/tests/rename/should_fail/rnfail013.stderr | 2 +- ghc/tests/rename/should_fail/rnfail014.stderr | 10 +-- ghc/tests/rename/should_fail/rnfail015.stderr | 5 +- ghc/tests/stranal/should_compile/str001.stderr | 2 +- ghc/tests/typecheck/should_compile/tc097.hs | 6 +- ghc/tests/typecheck/should_compile/tc097.stderr | 11 +-- ghc/tests/typecheck/should_fail/tcfail039.hs | 7 +- ghc/tests/typecheck/should_fail/tcfail039.stderr | 9 ++- 27 files changed, 121 insertions(+), 118 deletions(-) diff --git a/ghc/tests/Makefile b/ghc/tests/Makefile index c23b020..e3667e6 100644 --- a/ghc/tests/Makefile +++ b/ghc/tests/Makefile @@ -13,11 +13,11 @@ SUBDIRS = \ rename \ simplCore \ stranal \ - typecheck + typecheck \ + programs # printing \ # io \ -# programs include $(TOP)/mk/target.mk diff --git a/ghc/tests/programs/Makefile b/ghc/tests/programs/Makefile index 2a57051..617e589 100644 --- a/ghc/tests/programs/Makefile +++ b/ghc/tests/programs/Makefile @@ -1,7 +1,15 @@ TOP = . include $(TOP)/mk/boilerplate.mk -NOT_THESE = Makefile ipoole_spec_class areid_pass +NOT_THESE = CVS mk Makefile \ + +NOT_THESE += hill_stk_oflow +# Correctly fails to terminate + +NOT_THESE += ipoole_spec_class +# Dialogue style IO + +# areid_pass SUBDIRS = $(filter-out $(NOT_THESE), $(wildcard *)) diff --git a/ghc/tests/programs/fast2haskell/Fast2haskell.hs b/ghc/tests/programs/fast2haskell/Fast2haskell.hs index de3aa0f..5261173 100644 --- a/ghc/tests/programs/fast2haskell/Fast2haskell.hs +++ b/ghc/tests/programs/fast2haskell/Fast2haskell.hs @@ -6,7 +6,8 @@ land_i, lnot_i, lor_i, lshift_i, rshift_i, descr, destr_update, indassoc, lowbound, tabulate, upbound, update, valassoc) where { - import Word2; + import Bits; + import Word; import Complex; -- 1.3 import Array; -- 1.3 type Complex_type = Complex Double; @@ -19,23 +20,22 @@ force x = x; -- error "force not implemented"; iff b x y = if b then x else y; iffrev y x b = if b then x else y; - seQ x y = seq_const y (x{-#STRICT-}); - seq_const x y = x ; + seQ x y = x `seq` y; pair [] = False; pair x = True; strcmp :: [Char] -> [Char] -> Bool; strcmp x y = x == y; entier x = fromIntegral (floor x); land_i :: Int -> Int -> Int; - land_i x y = wordToInt (bitAnd (fromInt x) (fromInt y)); + land_i x y = wordToInt (fromInt x .&. fromInt y); lnot_i :: Int -> Int; - lnot_i x = wordToInt (bitCompl (fromInt x)); + lnot_i x = wordToInt (complement (fromInt x)); lor_i :: Int -> Int -> Int; - lor_i x y = wordToInt (bitOr (fromInt x) (fromInt y)); + lor_i x y = wordToInt (fromInt x .|. fromInt y); lshift_i :: Int -> Int -> Int; - lshift_i x y = wordToInt (bitLsh (fromInt x) y); + lshift_i x y = wordToInt (fromInt x `shiftL` y); rshift_i :: Int -> Int -> Int; - rshift_i x y = wordToInt (bitRsh (fromInt x) y); + rshift_i x y = wordToInt (fromInt x `shiftR` y); write x = abortstr "write not implemented"; descr l u = (l,u); destr_update ar i x = ar // [(i,x)]; diff --git a/ghc/tests/programs/jon_polycase/Foo.lhs b/ghc/tests/programs/jon_polycase/Foo.lhs index 3606505..daa9c3d 100644 --- a/ghc/tests/programs/jon_polycase/Foo.lhs +++ b/ghc/tests/programs/jon_polycase/Foo.lhs @@ -49,7 +49,7 @@ Likewise if you change the type of LinearCode to Int! > getRepInterp (RepInterp a ) = a > instance Functor Interpreter where -> map f (RepInterp intp ) +> fmap f (RepInterp intp ) > = RepInterp (\s -> case intp s of > g -> g >>= \q -> > case q of @@ -81,4 +81,4 @@ Likewise if you change the type of LinearCode to Int! > class Monad m => OutputMonad m where > out :: String -> m () > instance OutputMonad IO where -> out s = catch (putStr s) (\_ -> fail $userError "Oh MY") +> out s = catch (putStr s) (\_ -> ioError $ userError "Oh MY") diff --git a/ghc/tests/reader/should_fail/expr001.stderr b/ghc/tests/reader/should_fail/expr001.stderr index 169d246..8b8731c 100644 --- a/ghc/tests/reader/should_fail/expr001.stderr +++ b/ghc/tests/reader/should_fail/expr001.stderr @@ -2,13 +2,12 @@ ==================== Reader ==================== module Main where {- rec -} -f x = x + (if c then 1 else 2) -f x = x + 1 :: Int +f x = x zp (if c then 1 else 2) +f x = x zp 1 :: Int - -expr001.hs:10: Value not in scope: `c' +expr001.hs:10: Variable not in scope: `c' Compilation had errors diff --git a/ghc/tests/reader/should_fail/read001.stderr b/ghc/tests/reader/should_fail/read001.stderr index 23b140c..3e0d15f 100644 --- a/ghc/tests/reader/should_fail/read001.stderr +++ b/ghc/tests/reader/should_fail/read001.stderr @@ -1,9 +1,9 @@ ==================== Reader ==================== module OneOfEverything ( - fixn, FooData, FooDataB(..), FooDataC(..), EqTree(EqLeaf, - EqBranch), EqClass(..), OrdClass(orda, - ordb), module OneC, module OneOfEverything + fixn, FooData, FooDataB(..), FooDataC(..), + EqTree(EqLeaf, EqBranch), EqClass(..), OrdClass(orda, ordb), + module OneC, module OneOfEverything ) where import Prelude import IO (putStr) @@ -32,31 +32,32 @@ mat a b c d | foof b c = d where {- rec -} - foof a b = a == b + foof a b = a zeze b expr a b c d - = ((((((((a + (: a b)) + (a : b)) + (((1 - 'c') - "abc") - 1.293)) - + ((\ x y z -> x) 42)) - + ((9 *))) - + ((* 8))) - + (case x of - Prelude.[] - | null x -> 99 - | otherwise -> 98 - | True -> 97 - where - {- rec -} - null x = False)) - + ([z | z <- c, isSpace z])) - + (let - {- rec -} - y = foo - in - (((((((y + [1, 2, 3, 4]) + (4, 3, 2, 1)) + (4 :: (Num a) => a)) - + (if 42 == 42.0 then 1 else 4)) - + ([1 .. ])) - + ([2, 4 .. ])) - + ([3 .. 5])) - + ([4, 8 .. 999])) + = ((((((((a zp (ZC a b)) zp (a ZC b)) + zp (((1 zm 'c') zm "abc") zm 1.293)) + zp ((\ x y zz -> x) 42)) + zp ((9 zt))) + zp ((zt 8))) + zp (case x of + Prelude.ZMZN + | null x -> 99 + | otherwise -> 98 + | True -> 97 + where + {- rec -} + null x = False)) + zp ([zz | zz <- c, isSpace zz])) + zp (let + {- rec -} + y = foo + in + (((((((y zp [1, 2, 3, 4]) zp (4, 3, 2, 1)) zp (4 :: (Num a) => a)) + zp (if 42 zeze 42.0 then 1 else 4)) + zp ([1 .. ])) + zp ([2, 4 .. ])) + zp ([3 .. 5])) + zp ([4, 8 .. 999])) f _ x 1 @@ -64,13 +65,13 @@ f _ 'c' "dog" ~y - (z@(Foo a b)) + (zz@(Foo a b)) (c Bar d) [1, 2] (3, 4) ((n+42)) = y -g x y z = head y +g x y zz = head y default (Integer, Rational) instance (Eq a) => EqClass (EqTree a) where [] @@ -87,36 +88,32 @@ data FooDataB = FooConB Double data FooData = FooCon Int type Pair a b = (a, b) infixr 8 fixr -infixl 7 +# +infixl 7 zpzh infix 6 fixn - -read001.hs:20: Warning: Unused fixity declaration for `+#' - read001.hs:5: Type constructor or class not in scope: `FooDataC' - + read001.hs:5: Unknown module in export list: module `OneC' - + read001.hs:40: Type constructor or class not in scope: `EqLeaf' - + read001.hs:40: Type constructor or class not in scope: `EqLeaf' - -read001.hs:80: Value not in scope: `isSpace' - -read001.hs:87: Value not in scope: `x' - -read001.hs:87: Value not in scope: `x' - -read001.hs:95: Value not in scope: `foo' - + +read001.hs:80: Variable not in scope: `isSpace' + +read001.hs:87: Variable not in scope: `x' + +read001.hs:87: Variable not in scope: `x' + +read001.hs:95: Variable not in scope: `foo' + read001.hs:107: Data constructor not in scope: `Foo' - + read001.hs:107: Data constructor not in scope: `Bar' - -read001.hs:112: Type constructor or class not in scope: `Foo' +read001.hs:112: Type constructor or class not in scope: `Foo' Compilation had errors diff --git a/ghc/tests/reader/should_fail/read003.stderr b/ghc/tests/reader/should_fail/read003.stderr index e4a38a3..9deee4d 100644 --- a/ghc/tests/reader/should_fail/read003.stderr +++ b/ghc/tests/reader/should_fail/read003.stderr @@ -11,14 +11,12 @@ module Read003 where nullity = null - + read003.hs:4: - Occurs check: cannot construct the infinite type: - t = (t, [a], _116) - Expected type: (t, [a], _116) + Occurs check: cannot construct the infinite type: t = (t, [a], t1) + Expected type: (t, [a], t1) Inferred type: t In the right-hand side of a pattern binding: a - Compilation had errors diff --git a/ghc/tests/reader/should_fail/read006.stderr b/ghc/tests/reader/should_fail/read006.stderr index d7814a4..230584f 100644 --- a/ghc/tests/reader/should_fail/read006.stderr +++ b/ghc/tests/reader/should_fail/read006.stderr @@ -1 +1 @@ -read006.hs:5:7: pattern syntax used in expression on input: "_" +read006.hs:8:12: parse error on input: "@" diff --git a/ghc/tests/rename/should_compile/rn017.stderr b/ghc/tests/rename/should_compile/rn017.stderr index 97e1a59..d70cd06 100644 --- a/ghc/tests/rename/should_compile/rn017.stderr +++ b/ghc/tests/rename/should_compile/rn017.stderr @@ -1,3 +1,3 @@ ghc: module version changed to 1; reason: no old .hi file -__export Rn017 a b c Wibble{MkWibble} Wobble; -__export Test f FOO{op} Foo{MkFoo}; +__export Rn017 Wibble{MkWibble} Wobble a b c; +__export Test FOO{op} Foo{MkFoo} f; diff --git a/ghc/tests/rename/should_fail/rnfail001.stderr b/ghc/tests/rename/should_fail/rnfail001.stderr index aa56cac..5f6ddc5 100644 --- a/ghc/tests/rename/should_fail/rnfail001.stderr +++ b/ghc/tests/rename/should_fail/rnfail001.stderr @@ -1,5 +1,7 @@ - -rnfail001.hs:3: Conflicting definitions for `x' in pattern + +rnfail001.hs:3: + Conflicting definitions for `x' + in a pattern Compilation had errors diff --git a/ghc/tests/rename/should_fail/rnfail002.stderr b/ghc/tests/rename/should_fail/rnfail002.stderr index 4a0a131..75ba87b 100644 --- a/ghc/tests/rename/should_fail/rnfail002.stderr +++ b/ghc/tests/rename/should_fail/rnfail002.stderr @@ -1,4 +1,4 @@ - + rnfail002.hs:4: Multiple declarations of `y' defined at rnfail002.hs:5 diff --git a/ghc/tests/rename/should_fail/rnfail003.stderr b/ghc/tests/rename/should_fail/rnfail003.stderr index cd3ec69..61ffb25 100644 --- a/ghc/tests/rename/should_fail/rnfail003.stderr +++ b/ghc/tests/rename/should_fail/rnfail003.stderr @@ -1,4 +1,4 @@ - + rnfail003.hs:2: Multiple declarations of `f' defined at rnfail003.hs:2 diff --git a/ghc/tests/rename/should_fail/rnfail004.stderr b/ghc/tests/rename/should_fail/rnfail004.stderr index 1136eea..5a256e7 100644 --- a/ghc/tests/rename/should_fail/rnfail004.stderr +++ b/ghc/tests/rename/should_fail/rnfail004.stderr @@ -1,7 +1,11 @@ - -rnfail004.hs:6: Conflicting definitions for `a' in binding group - -rnfail004.hs:7: Conflicting definitions for `b' in binding group + +rnfail004.hs:6: + Conflicting definitions for `a' + in a binding group + +rnfail004.hs:7: + Conflicting definitions for `b' + in a binding group Compilation had errors diff --git a/ghc/tests/rename/should_fail/rnfail007.stderr b/ghc/tests/rename/should_fail/rnfail007.stderr index 7e8bc0e..d3c6a49 100644 --- a/ghc/tests/rename/should_fail/rnfail007.stderr +++ b/ghc/tests/rename/should_fail/rnfail007.stderr @@ -1,6 +1,5 @@ - -rnfail007.hs:3: - Module `Main' must include a definition for `Main.main' + +rnfail007.hs:3: Module `Main' must include a definition for `main' Compilation had errors diff --git a/ghc/tests/rename/should_fail/rnfail008.stderr b/ghc/tests/rename/should_fail/rnfail008.stderr index be1cc77..044582f 100644 --- a/ghc/tests/rename/should_fail/rnfail008.stderr +++ b/ghc/tests/rename/should_fail/rnfail008.stderr @@ -1,5 +1,5 @@ - -rnfail008.hs:18: Value not in scope: `op3' + +rnfail008.hs:18: Variable not in scope: `op3' Compilation had errors diff --git a/ghc/tests/rename/should_fail/rnfail009.stderr b/ghc/tests/rename/should_fail/rnfail009.stderr index 774e538..066aaef 100644 --- a/ghc/tests/rename/should_fail/rnfail009.stderr +++ b/ghc/tests/rename/should_fail/rnfail009.stderr @@ -1,4 +1,4 @@ - + rnfail009.hs:1: Multiple declarations of `A' defined at rnfail009.hs:3 diff --git a/ghc/tests/rename/should_fail/rnfail010.stderr b/ghc/tests/rename/should_fail/rnfail010.stderr index d19435b..2137a44 100644 --- a/ghc/tests/rename/should_fail/rnfail010.stderr +++ b/ghc/tests/rename/should_fail/rnfail010.stderr @@ -1,4 +1,4 @@ - + rnfail010.hs:2: Multiple declarations of `f' defined at rnfail010.hs:2 diff --git a/ghc/tests/rename/should_fail/rnfail011.stderr b/ghc/tests/rename/should_fail/rnfail011.stderr index 8a33a31..5bae760 100644 --- a/ghc/tests/rename/should_fail/rnfail011.stderr +++ b/ghc/tests/rename/should_fail/rnfail011.stderr @@ -1,4 +1,4 @@ - + rnfail011.hs:2: Multiple declarations of `A' defined at rnfail011.hs:2 diff --git a/ghc/tests/rename/should_fail/rnfail012.stderr b/ghc/tests/rename/should_fail/rnfail012.stderr index bee8e16..0f5e86f 100644 --- a/ghc/tests/rename/should_fail/rnfail012.stderr +++ b/ghc/tests/rename/should_fail/rnfail012.stderr @@ -1,4 +1,4 @@ - + rnfail012.hs:2: Multiple declarations of `A' defined at rnfail012.hs:3 diff --git a/ghc/tests/rename/should_fail/rnfail013.stderr b/ghc/tests/rename/should_fail/rnfail013.stderr index 86c73ba..2e7f52a 100644 --- a/ghc/tests/rename/should_fail/rnfail013.stderr +++ b/ghc/tests/rename/should_fail/rnfail013.stderr @@ -1,4 +1,4 @@ - + rnfail013.hs:3: Multiple declarations of `MkT' defined at rnfail013.hs:7 diff --git a/ghc/tests/rename/should_fail/rnfail014.stderr b/ghc/tests/rename/should_fail/rnfail014.stderr index 460650a..ed49f1d 100644 --- a/ghc/tests/rename/should_fail/rnfail014.stderr +++ b/ghc/tests/rename/should_fail/rnfail014.stderr @@ -1,28 +1,28 @@ - + rnfail014.hs:9: The constraint `Eq a' does not mention any of the universally quantified type variables {} of the type `Eq Bool' In the type signature for an instance decl - + rnfail014.hs:9: The constraint `Eq a' mentions type variables that do not appear in the type `Eq Bool' In the type signature for an instance decl - + rnfail014.hs:12: The constraint `Eq a' does not mention any of the universally quantified type variables {} of the type `Int -> Int' In the type signature for `f' - + rnfail014.hs:12: The constraint `Eq a' mentions type variables that do not appear in the type `Int -> Int' In the type signature for `f' - + rnfail014.hs:17: The constraint `Eq a' does not mention any of the universally quantified type variables {} diff --git a/ghc/tests/rename/should_fail/rnfail015.stderr b/ghc/tests/rename/should_fail/rnfail015.stderr index 5dfde4c..184c750 100644 --- a/ghc/tests/rename/should_fail/rnfail015.stderr +++ b/ghc/tests/rename/should_fail/rnfail015.stderr @@ -1,6 +1,7 @@ - + rnfail015.hs:9: - Conflicting definitions for `TokLiteral' in the data type declaration for Token + Conflicting definitions for `TokLiteral' + in the data type declaration for `Token' Compilation had errors diff --git a/ghc/tests/stranal/should_compile/str001.stderr b/ghc/tests/stranal/should_compile/str001.stderr index 6c089a3..f9aaece 100644 --- a/ghc/tests/stranal/should_compile/str001.stderr +++ b/ghc/tests/stranal/should_compile/str001.stderr @@ -1,2 +1,2 @@ ghc: module version changed to 1; reason: no old .hi file -__export ShouldSucceed area2 Point2{Point2}; +__export ShouldSucceed Point2{Point2} area2; diff --git a/ghc/tests/typecheck/should_compile/tc097.hs b/ghc/tests/typecheck/should_compile/tc097.hs index 448e631..545b094 100644 --- a/ghc/tests/typecheck/should_compile/tc097.hs +++ b/ghc/tests/typecheck/should_compile/tc097.hs @@ -3,8 +3,8 @@ module ShouldSucceed where import PrelGHC -- to get at All -data Monad2 m = MkMonad2 (All a => a -> m a) - ((All a, All b) => m a -> (a -> m b) -> m b) +data Monad2 m = MkMonad2 (forall a. a -> m a) + (forall a b. m a -> (a -> m b) -> m b) -halfListMonad :: ((All a, All b) => [a] -> (a -> [b]) -> [b]) -> Monad2 [] +halfListMonad :: (forall a b. [a] -> (a -> [b]) -> [b]) -> Monad2 [] halfListMonad b = MkMonad2 (\x -> [x]) b diff --git a/ghc/tests/typecheck/should_compile/tc097.stderr b/ghc/tests/typecheck/should_compile/tc097.stderr index 19704af..ab820aa 100644 --- a/ghc/tests/typecheck/should_compile/tc097.stderr +++ b/ghc/tests/typecheck/should_compile/tc097.stderr @@ -1,9 +1,4 @@ ghc: module version changed to 1; reason: no old .hi file -_exports_ -ShouldSucceed halfListMonad Monad2(MkMonad2); -_instances_ -instance _forall_ [a :: (* -> *)] => {PrelBase.Eval (Monad2 a)} = $dEvalMonad20; -_declarations_ -1 $dEvalMonad20 _:_ _forall_ [a :: (* -> *)] => {PrelBase.Eval (Monad2 a)} ;; -1 data Monad2 m :: (* -> *) = MkMonad2 (_forall_ [a] => a -> m a) (_forall_ [a b] => m a -> (a -> m b) -> m b) ; -1 halfListMonad _:_ (_forall_ [a b] => [a] -> (a -> [b]) -> [b]) -> Monad2 PrelBase.[] ;; +__export ShouldSucceed Monad2{MkMonad2} halfListMonad; +1 data Monad2 m :: (* -> *) = MkMonad2 (__forall [a] => a -> m a) (__forall [a b] => m a -> (a -> m b) -> m b) ; +1 halfListMonad :: (__forall [a b] => [a] -> (a -> [b]) -> [b]) -> Monad2 PrelBase.ZMZN ; diff --git a/ghc/tests/typecheck/should_fail/tcfail039.hs b/ghc/tests/typecheck/should_fail/tcfail039.hs index 7672436..3340c3b 100644 --- a/ghc/tests/typecheck/should_fail/tcfail039.hs +++ b/ghc/tests/typecheck/should_fail/tcfail039.hs @@ -6,7 +6,6 @@ data NUM = ONE | TWO class EQ a where (==) :: a -> a -> Bool -instance EQ NUM --- a /= b = False --- a == b = True --- a /= b = False +instance EQ NUM where + a /= b = False + a == b = True diff --git a/ghc/tests/typecheck/should_fail/tcfail039.stderr b/ghc/tests/typecheck/should_fail/tcfail039.stderr index 848dd21..35e23de 100644 --- a/ghc/tests/typecheck/should_fail/tcfail039.stderr +++ b/ghc/tests/typecheck/should_fail/tcfail039.stderr @@ -1,8 +1,9 @@ - -tcfail039.hs:7: + +tcfail039.hs:11: Ambiguous occurrence `==' - It could refer to: ==: defined at tcfail039.hs:7 - PrelBase.==: imported from Prelude at tcfail039.hs:3 + It could refer to either `==', defined at tcfail039.hs:7 + or `Prelude.==', imported from Prelude at tcfail039.hs:3 + Compilation had errors -- 1.7.10.4