summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/typecheck/should_run/T10284.hs17
-rw-r--r--testsuite/tests/typecheck/should_run/T10284.stderr5
-rw-r--r--testsuite/tests/typecheck/should_run/T10284.stdout5
-rwxr-xr-xtestsuite/tests/typecheck/should_run/all.T1
4 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_run/T10284.hs b/testsuite/tests/typecheck/should_run/T10284.hs
new file mode 100644
index 0000000000..8fc86351a0
--- /dev/null
+++ b/testsuite/tests/typecheck/should_run/T10284.hs
@@ -0,0 +1,17 @@
+{-# OPTIONS_GHC -fdefer-type-errors -fno-warn-deferred-type-errors #-}
+
+import Control.Exception
+
+a :: Int
+a = 'a'
+
+main :: IO ()
+main = do
+ catch (evaluate a)
+ (\e -> do let err = show (e :: TypeError)
+ putStrLn ("As expected, TypeError: " ++ err)
+ return "")
+ catch (evaluate a)
+ (\e -> do let err = show (e :: ErrorCall)
+ putStrLn ("Something went horribly wrong: " ++ err)
+ return "")
diff --git a/testsuite/tests/typecheck/should_run/T10284.stderr b/testsuite/tests/typecheck/should_run/T10284.stderr
new file mode 100644
index 0000000000..c7133f0172
--- /dev/null
+++ b/testsuite/tests/typecheck/should_run/T10284.stderr
@@ -0,0 +1,5 @@
+T10284: T10284.hs:14:19: error:
+ Couldn't match expected type ‘()’ with actual type ‘Int’
+ In the first argument of ‘evaluate’, namely ‘a’
+ In the first argument of ‘catch’, namely ‘(evaluate a)’
+(deferred type error)
diff --git a/testsuite/tests/typecheck/should_run/T10284.stdout b/testsuite/tests/typecheck/should_run/T10284.stdout
new file mode 100644
index 0000000000..ea03ec8a1a
--- /dev/null
+++ b/testsuite/tests/typecheck/should_run/T10284.stdout
@@ -0,0 +1,5 @@
+As expected, TypeError: T10284.hs:6:5: error:
+ Couldn't match expected type ‘Int’ with actual type ‘Char’
+ In the expression: 'a'
+ In an equation for ‘a’: a = 'a'
+(deferred type error)
diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T
index 4195ca8715..b1525bdc00 100755
--- a/testsuite/tests/typecheck/should_run/all.T
+++ b/testsuite/tests/typecheck/should_run/all.T
@@ -119,3 +119,4 @@ test('T9497b-run', [exit_code(1)], compile_and_run, ['-fdefer-typed-holes -fno-w
test('T9497c-run', [exit_code(1)], compile_and_run, ['-fdefer-type-errors -fno-warn-typed-holes'])
test('T9858c', normal, compile_and_run, [''])
test('T9858d', normal, compile_and_run, [''])
+test('T10284', exit_code(1), compile_and_run, [''])