diff --git a/ghc/tests/deriving/should_run/Makefile b/ghc/tests/deriving/should_run/Makefile index 91428646c86acc7194b4ef390758cb9b6e4f9be9..d39565dce6b24221c475a8ad882f020eca0f0077 100644 --- a/ghc/tests/deriving/should_run/Makefile +++ b/ghc/tests/deriving/should_run/Makefile @@ -4,4 +4,6 @@ include $(TOP)/mk/should_run.mk SRC_HC_OPTS += -dcore-lint +drvrun005_RUNTEST_OPTS += -fail + include $(TOP)/mk/target.mk diff --git a/ghc/tests/deriving/should_run/drvrun004.hs b/ghc/tests/deriving/should_run/drvrun004.hs new file mode 100644 index 0000000000000000000000000000000000000000..f530803835d7521526d83ff1d020c25a097a4b28 --- /dev/null +++ b/ghc/tests/deriving/should_run/drvrun004.hs @@ -0,0 +1,10 @@ +module Main where + +data Hash = Hash{ (#) :: Int } + deriving (Show, Read) + +main = + do print s + print (read s :: Hash) + where + s = show (Hash 3) diff --git a/ghc/tests/deriving/should_run/drvrun004.stdout b/ghc/tests/deriving/should_run/drvrun004.stdout new file mode 100644 index 0000000000000000000000000000000000000000..c9f6f36275e1d75b81e459393ae13f32e4ce68b3 --- /dev/null +++ b/ghc/tests/deriving/should_run/drvrun004.stdout @@ -0,0 +1,2 @@ +"Hash{(#)=3}" +Hash{(#)=3} diff --git a/ghc/tests/deriving/should_run/drvrun005.hs b/ghc/tests/deriving/should_run/drvrun005.hs new file mode 100644 index 0000000000000000000000000000000000000000..0d21690b2fa0f95e6bfd2d999777a9674d0fa2af --- /dev/null +++ b/ghc/tests/deriving/should_run/drvrun005.hs @@ -0,0 +1,22 @@ +module Main where + +{- + If a fixity declaration hasn't been supplied for + an operator, it is defaulted to being "infixl 9". + + The derived Read instances for data types containing + left-assoc constructors produces code that causes + non-termination if you use 'read' to evaluate them + ( (head (reads x)) is cool tho.) + + ==> The inferred assoc for :++ below left & the derived + Read instance should fail to terminate (with ghc-4.xx, + this is exemplified by having the stack overflow.) +-} +-- infixl 9 :++ +data T = T1 | T :++ T deriving (Eq,Show, Read) + +t :: T +t = read "T1" + +main = print t diff --git a/ghc/tests/deriving/should_run/drvrun005.stderr b/ghc/tests/deriving/should_run/drvrun005.stderr new file mode 100644 index 0000000000000000000000000000000000000000..68c824b709a23d705cb5447cd5926f91012cc211 --- /dev/null +++ b/ghc/tests/deriving/should_run/drvrun005.stderr @@ -0,0 +1,2 @@ +Stack space overflow: current size 1048576 bytes. +Use `+RTS -Ksize' to increase it.