[project @ 1999-07-05 17:02:42 by sof]
authorsof <unknown>
Mon, 5 Jul 1999 17:02:42 +0000 (17:02 +0000)
committersof <unknown>
Mon, 5 Jul 1999 17:02:42 +0000 (17:02 +0000)
Two new Dark Corner regression tests:

- testing the derived Show&Read instances for constructors with
  a field label that is a varsym rather than a varid.
- check that the default fixity & assoc of an operator is 'infixl 9'.

ghc/tests/deriving/should_run/Makefile
ghc/tests/deriving/should_run/drvrun004.hs [new file with mode: 0644]
ghc/tests/deriving/should_run/drvrun004.stdout [new file with mode: 0644]
ghc/tests/deriving/should_run/drvrun005.hs [new file with mode: 0644]
ghc/tests/deriving/should_run/drvrun005.stderr [new file with mode: 0644]

index 9142864..d39565d 100644 (file)
@@ -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 (file)
index 0000000..f530803
--- /dev/null
@@ -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 (file)
index 0000000..c9f6f36
--- /dev/null
@@ -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 (file)
index 0000000..0d21690
--- /dev/null
@@ -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 (file)
index 0000000..68c824b
--- /dev/null
@@ -0,0 +1,2 @@
+Stack space overflow: current size 1048576 bytes.
+Use `+RTS -Ksize' to increase it.