summaryrefslogtreecommitdiff
path: root/testsuite
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
parentc23beffd65fd0eb50e7fe3a53a89220252aadd74 (diff)
downloadhaskell-74ae59896e4222a8115f5548845f13495f5bb76e.tar.gz
Defer errors in derived instances
Fixes Trac #9576. Turned out to be pretty easy.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/deriving/should_fail/T4846.stderr2
-rw-r--r--testsuite/tests/deriving/should_fail/drvfail011.stderr2
-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
6 files changed, 24 insertions, 2 deletions
diff --git a/testsuite/tests/deriving/should_fail/T4846.stderr b/testsuite/tests/deriving/should_fail/T4846.stderr
index 6024165c25..8d6198ea8e 100644
--- a/testsuite/tests/deriving/should_fail/T4846.stderr
+++ b/testsuite/tests/deriving/should_fail/T4846.stderr
@@ -9,6 +9,6 @@ T4846.hs:29:1:
In an equation for ‘mkExpr’:
mkExpr = GHC.Prim.coerce (mkExpr :: Expr Bool) :: Expr BOOL
When typechecking the code for ‘mkExpr’
- in a standalone derived instance for ‘B BOOL’:
+ in a derived instance for ‘B BOOL’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘B BOOL’
diff --git a/testsuite/tests/deriving/should_fail/drvfail011.stderr b/testsuite/tests/deriving/should_fail/drvfail011.stderr
index 99e62fc48e..6ea42e1b08 100644
--- a/testsuite/tests/deriving/should_fail/drvfail011.stderr
+++ b/testsuite/tests/deriving/should_fail/drvfail011.stderr
@@ -5,6 +5,6 @@ drvfail011.hs:8:1:
In the expression: ((a1 == b1))
In an equation for ‘==’: (==) (T1 a1) (T1 b1) = ((a1 == b1))
When typechecking the code for ‘==’
- in a standalone derived instance for ‘Eq (T a)’:
+ in a derived instance for ‘Eq (T a)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Eq (T a)’
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, [''])