From f1ab7d658d2a332bbea3f62e30c8bcd272dc1043 Mon Sep 17 00:00:00 2001 From: sof Date: Sat, 26 Jul 1997 23:26:08 +0000 Subject: [PATCH] [project @ 1997-07-26 23:25:57 by sof] --- ghc/tests/reader/should_compile/Makefile | 22 +++++ ghc/tests/reader/should_compile/OneA.hi | 15 ++++ ghc/tests/reader/should_compile/OneB.hi | 3 + ghc/tests/reader/should_compile/OneC.hi | 3 + ghc/tests/reader/should_compile/expr001.hs | 14 +++ ghc/tests/reader/should_compile/expr001.stderr | 6 ++ ghc/tests/reader/should_compile/read001.hs | 113 ++++++++++++++++++++++++ ghc/tests/reader/should_compile/read001.stderr | 1 + ghc/tests/reader/should_compile/read002.hs | 14 +++ ghc/tests/reader/should_compile/read002.stderr | 16 ++++ ghc/tests/reader/should_compile/read003.hs | 8 ++ ghc/tests/reader/should_compile/read003.stderr | 21 +++++ ghc/tests/reader/should_compile/read004.hs | 41 +++++++++ ghc/tests/reader/should_compile/read004.stderr | 2 + ghc/tests/reader/should_compile/read005.hs | 2 + 15 files changed, 281 insertions(+) create mode 100644 ghc/tests/reader/should_compile/Makefile create mode 100644 ghc/tests/reader/should_compile/OneA.hi create mode 100644 ghc/tests/reader/should_compile/OneB.hi create mode 100644 ghc/tests/reader/should_compile/OneC.hi create mode 100644 ghc/tests/reader/should_compile/expr001.hs create mode 100644 ghc/tests/reader/should_compile/expr001.stderr create mode 100644 ghc/tests/reader/should_compile/read001.hs create mode 100644 ghc/tests/reader/should_compile/read001.stderr create mode 100644 ghc/tests/reader/should_compile/read002.hs create mode 100644 ghc/tests/reader/should_compile/read002.stderr create mode 100644 ghc/tests/reader/should_compile/read003.hs create mode 100644 ghc/tests/reader/should_compile/read003.stderr create mode 100644 ghc/tests/reader/should_compile/read004.hs create mode 100644 ghc/tests/reader/should_compile/read004.stderr create mode 100644 ghc/tests/reader/should_compile/read005.hs diff --git a/ghc/tests/reader/should_compile/Makefile b/ghc/tests/reader/should_compile/Makefile new file mode 100644 index 0000000..fe5fca9 --- /dev/null +++ b/ghc/tests/reader/should_compile/Makefile @@ -0,0 +1,22 @@ +TOP = ../../.. +include $(TOP)/mk/boilerplate.mk + + +HS_SRCS = $(wildcard *.hs) +SRC_RUNTEST_OPTS += -accept-output -o1 $*.stdout -o2 $*.stderr -x 1 +HC_OPTS += -noC -dcore-lint + +read002_RUNTEST_OPTS = -x 0 + +%.o : %.hs + +%.o : %.hs + $(RUNTEST) $(HC) $(RUNTEST_OPTS) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@)) + +all :: $(HS_OBJS) + +read001_HC_OPTS = -noC -ddump-rdr +read002_HC_OPTS = -noC -ddump-rdr +read004_HC_OPTS = -noC -fno-implicit-prelude -ddump-rdr + +include $(TOP)/mk/target.mk diff --git a/ghc/tests/reader/should_compile/OneA.hi b/ghc/tests/reader/should_compile/OneA.hi new file mode 100644 index 0000000..42ed194 --- /dev/null +++ b/ghc/tests/reader/should_compile/OneA.hi @@ -0,0 +1,15 @@ +interface OneA where + +import OneB ( fB ) renaming ( fB to fBa ) + +type SynA = Float + +data DataAA +data (Ord a) => DataAB a = ConAB1 a | ConAB2 deriving Text + +class (Ord a) => ClassA a where + clsA :: a -> String + +instance ClassA Int + +fA :: a -> a diff --git a/ghc/tests/reader/should_compile/OneB.hi b/ghc/tests/reader/should_compile/OneB.hi new file mode 100644 index 0000000..78f55ee --- /dev/null +++ b/ghc/tests/reader/should_compile/OneB.hi @@ -0,0 +1,3 @@ +interface OneB where + +fB :: a -> a diff --git a/ghc/tests/reader/should_compile/OneC.hi b/ghc/tests/reader/should_compile/OneC.hi new file mode 100644 index 0000000..ded63cc --- /dev/null +++ b/ghc/tests/reader/should_compile/OneC.hi @@ -0,0 +1,3 @@ +interface OneC where + +fC :: a -> a diff --git a/ghc/tests/reader/should_compile/expr001.hs b/ghc/tests/reader/should_compile/expr001.hs new file mode 100644 index 0000000..49853a7 --- /dev/null +++ b/ghc/tests/reader/should_compile/expr001.hs @@ -0,0 +1,14 @@ +{- +From: Kevin Hammond +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 c then 1 else 2 +f x = x + 1::Int + +-- (the conditional/sig need to be parenthesised). If this is +-- problematic, let me know! diff --git a/ghc/tests/reader/should_compile/expr001.stderr b/ghc/tests/reader/should_compile/expr001.stderr new file mode 100644 index 0000000..3701c35 --- /dev/null +++ b/ghc/tests/reader/should_compile/expr001.stderr @@ -0,0 +1,6 @@ + +expr001.hs:10: + Value not in scope: `c' + + +Compilation had errors diff --git a/ghc/tests/reader/should_compile/read001.hs b/ghc/tests/reader/should_compile/read001.hs new file mode 100644 index 0000000..dc434eb --- /dev/null +++ b/ghc/tests/reader/should_compile/read001.hs @@ -0,0 +1,113 @@ +--!!! this module supposedly includes one of each Haskell construct + +-- HsImpExp stuff + +module OneOfEverything ( + fixn, + FooData, + FooDataB(..), + FooDataC( .. ), + EqTree(EqLeaf, EqBranch), + EqClass(..), + OrdClass(orda, ordb), + OneC.. , + OneOfEverything.. + ) where + +import OneA renaming ( fA to renamedA ) +import OneB ( fB ) +import OneC hiding ( fC ) +import OneC hiding ( fC ) renaming ( fc to renamedC ) + +-- HsDecls stuff + +infix 6 `fixn` +infixl 7 +# +infixr 8 `fixr` + +fixn x y = x +fixl x y = x +fixr x y = x + +type Pair a b = (a, b) + +data FooData = FooCon Int + +data FooDataB = FooConB Double + +data (Eq a) => EqTree a = EqLeaf a | EqBranch (EqLeaf a) (EqLeaf a) + +class (Eq a) => EqClass a where + eqc :: a -> Char + eqc x = '?' + +class (Ord a) => OrdClass a where + orda :: a -> Char + ordb :: a -> Char + ordc :: a -> Char + +instance (Eq a) => EqClass (EqTree a) where + eqc x = 'a' + +default (Integer, Rational) + +-- HsBinds stuff + +singlebind x = x + +bindwith :: (OrdClass a, OrdClass b) => a -> b -> b +bindwith a b = b + +reca a = recb a +recb a = reca a + +(~(a,b,c)) | nullity b = a + | nullity c = a + | otherwise = a + where + nullity = null + +-- HsMatches stuff + +mat a b c d | foof a b = d + | foof a c = d + | foof b c = d + where + foof a b = a == b + +-- HsExpr stuff +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 + [] | null x -> 99 + | otherwise -> 98 + | True -> 97 + where + null x = False + ) + + [ z | z <- c, isSpace z ] + + let 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] + +-- HsPat stuff +f _ x 1 1.93 'c' "dog" ~y z@(Foo a b) (c `Bar` d) [1,2] (3,4) (n+42) = y + +-- HsLit stuff -- done above + +-- HsTypes stuff +g :: (Num a, Eq b) => Foo a -> [b] -> (a,a,a) -> b +g x y z = head y diff --git a/ghc/tests/reader/should_compile/read001.stderr b/ghc/tests/reader/should_compile/read001.stderr new file mode 100644 index 0000000..4a188c3 --- /dev/null +++ b/ghc/tests/reader/should_compile/read001.stderr @@ -0,0 +1 @@ +read001.hs:13:9: parse error on input: "OneC.." diff --git a/ghc/tests/reader/should_compile/read002.hs b/ghc/tests/reader/should_compile/read002.hs new file mode 100644 index 0000000..b11f397 --- /dev/null +++ b/ghc/tests/reader/should_compile/read002.hs @@ -0,0 +1,14 @@ +--!!! tests fixity reading and printing +module Reader 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 diff --git a/ghc/tests/reader/should_compile/read002.stderr b/ghc/tests/reader/should_compile/read002.stderr new file mode 100644 index 0000000..aeb88ae --- /dev/null +++ b/ghc/tests/reader/should_compile/read002.stderr @@ -0,0 +1,16 @@ + + +================================================================================ +Reader: +module Reader where +infixl 1 f +infixr 2 \\\ +infix 3 :==> +infix 4 MkFoo +{- rec -} +\\\ :: + _forall_ [] {Eq a} => [a] -> [a] -> [a] +f x y = x +\\\ xs ys = xs +data Foo = + MkFoo Int | Float :==> Double diff --git a/ghc/tests/reader/should_compile/read003.hs b/ghc/tests/reader/should_compile/read003.hs new file mode 100644 index 0000000..a986760 --- /dev/null +++ b/ghc/tests/reader/should_compile/read003.hs @@ -0,0 +1,8 @@ +--!!! Irrefutable patterns + guards +module Read003 where + +~(a,b,c) | nullity b = a + | nullity c = a + | otherwise = a + where + nullity = null diff --git a/ghc/tests/reader/should_compile/read003.stderr b/ghc/tests/reader/should_compile/read003.stderr new file mode 100644 index 0000000..9a2e662 --- /dev/null +++ b/ghc/tests/reader/should_compile/read003.stderr @@ -0,0 +1,21 @@ + +read003.hs:8: Cannot construct the infinite type (occur check) + `t{-aK8-}' = `(t{-aK8-}, t{-aKb-}, t{-aKe-})' + Expected: `(t{-aK8-}, [a{-aKm-}], [a{-aKo-}])' + Inferred: `t{-aK8-}' + In a pattern binding: + ~(`a', `b', `c') + | [`nullity + b'] = + `a' + | [`nullity + c'] = + `a' + | [`PrelBase.otherwise'] = + `a' + where + `nullity' + = `PrelList.null' + + +Compilation had errors diff --git a/ghc/tests/reader/should_compile/read004.hs b/ghc/tests/reader/should_compile/read004.hs new file mode 100644 index 0000000..d02f7f4 --- /dev/null +++ b/ghc/tests/reader/should_compile/read004.hs @@ -0,0 +1,41 @@ +--!!! string gaps +--!!! +module Main(main) where + +----------- + +main = putStr "\ + +\Some girls give me money\n\ + +\Some girls buy me clothes\n\ + +\..." + +----------- + +main2 = putStr "\ +\ \ +..." + +----------- + +main3 = putStr "\ + +\Some girls give me money\n\ +-- and here is a comment +\Some girls buy me clothes\n\ + +\..." + +----------- + +main3 = putStr "\ +{- + and here is a nested {- comment -} +-} +\Some girls give me money\n\ + +\Some girls buy me clothes\n\ + +\..." diff --git a/ghc/tests/reader/should_compile/read004.stderr b/ghc/tests/reader/should_compile/read004.stderr new file mode 100644 index 0000000..e4c1f75 --- /dev/null +++ b/ghc/tests/reader/should_compile/read004.stderr @@ -0,0 +1,2 @@ +read004.hs:19:1: Illegal character: `.' in a string gap +read004.hs:19:1: on input: "." diff --git a/ghc/tests/reader/should_compile/read005.hs b/ghc/tests/reader/should_compile/read005.hs new file mode 100644 index 0000000..a3b91f4 --- /dev/null +++ b/ghc/tests/reader/should_compile/read005.hs @@ -0,0 +1,2 @@ +--!!! Empty comments terminating a file.. +main = print "Hello" -- -- 1.7.10.4