summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_run
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-09-24 11:22:52 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2014-09-26 10:56:46 +0100
commit74ae59896e4222a8115f5548845f13495f5bb76e (patch)
tree89ea05c141ff4bd1ba5d43732b8d58e03c1e1c78 /testsuite/tests/deriving/should_run
parentc23beffd65fd0eb50e7fe3a53a89220252aadd74 (diff)
downloadhaskell-74ae59896e4222a8115f5548845f13495f5bb76e.tar.gz
Defer errors in derived instances
Fixes Trac #9576. Turned out to be pretty easy.
Diffstat (limited to 'testsuite/tests/deriving/should_run')
-rw-r--r--testsuite/tests/deriving/should_run/T9576.hs9
-rw-r--r--testsuite/tests/deriving/should_run/T9576.stderr11
-rw-r--r--testsuite/tests/deriving/should_run/T9576.stdout1
-rw-r--r--testsuite/tests/deriving/should_run/all.T1
4 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_run/T9576.hs b/testsuite/tests/deriving/should_run/T9576.hs
new file mode 100644
index 0000000000..b80de9cc0e
--- /dev/null
+++ b/testsuite/tests/deriving/should_run/T9576.hs
@@ -0,0 +1,9 @@
+{-# OPTIONS_GHC -fdefer-type-errors #-}
+
+module Main where
+
+data Foo = MkFoo
+data Bar = MkBar Foo deriving Show
+
+main = do { print True; print (MkBar MkFoo) }
+
diff --git a/testsuite/tests/deriving/should_run/T9576.stderr b/testsuite/tests/deriving/should_run/T9576.stderr
new file mode 100644
index 0000000000..6f8bf7f4e7
--- /dev/null
+++ b/testsuite/tests/deriving/should_run/T9576.stderr
@@ -0,0 +1,11 @@
+T9576: T9576.hs:6:31:
+ No instance for (Show Foo) arising from a use of ‘showsPrec’
+ In the second argument of ‘(.)’, namely ‘(showsPrec 11 b1)’
+ In the second argument of ‘showParen’, namely
+ ‘((.) (showString "MkBar ") (showsPrec 11 b1))’
+ In the expression:
+ showParen ((a >= 11)) ((.) (showString "MkBar ") (showsPrec 11 b1))
+ When typechecking the code for ‘showsPrec’
+ in a derived instance for ‘Show Bar’:
+ To see the code I am typechecking, use -ddump-deriv
+(deferred type error)
diff --git a/testsuite/tests/deriving/should_run/T9576.stdout b/testsuite/tests/deriving/should_run/T9576.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/deriving/should_run/T9576.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/deriving/should_run/all.T b/testsuite/tests/deriving/should_run/all.T
index 572f95bacd..21c1962ed1 100644
--- a/testsuite/tests/deriving/should_run/all.T
+++ b/testsuite/tests/deriving/should_run/all.T
@@ -36,4 +36,5 @@ test('T5628', exit_code(1), compile_and_run, [''])
test('T5712', normal, compile_and_run, [''])
test('T7931', normal, compile_and_run, [''])
test('T8280', normal, compile_and_run, [''])
+test('T9576', exit_code(1), compile_and_run, [''])