summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T12921.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-01-12 10:59:08 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-01-12 12:58:03 +0000
commitf5f6d4237b87f5d0e3e0a05e4cfc52bb3c0e4ad9 (patch)
treecd231caa17a831190e7cac61d9a582aafbc0a0bb /testsuite/tests/typecheck/should_fail/T12921.hs
parent89ce9cd3e011982eb0bcd7e11ec70ef8457b02be (diff)
downloadhaskell-f5f6d4237b87f5d0e3e0a05e4cfc52bb3c0e4ad9.tar.gz
Fix top-level constraint handling (Trac #12921)
Some out-of-scope errors were not being reported if anyone throws an un-caught exception in the TcM monad. That led to ghc: panic! (the 'impossible' happened) initTc: unsolved constraints I fixed this * Splitting captureConstraints to use an auxilliary tryCaptureConstraints (which never fails) * Define a new TcSimplify.captureTopConstraints (replacing the old TcRnMonad.captureTopConstraints), which reports any unsolved out-of-scope constraints before propagating the exception That in turn allowed me to do some tidying up of the static-constraint machinery, reducing duplication. Also solves #13106.
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T12921.hs')
-rw-r--r--testsuite/tests/typecheck/should_fail/T12921.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T12921.hs b/testsuite/tests/typecheck/should_fail/T12921.hs
new file mode 100644
index 0000000000..4b4aa2754a
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T12921.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE OverloadedStrings #-}
+module T12921 (stat) where
+
+{-# ANN module "HLint: ignore Reduce duplication" #-}
+
+stat :: Int -> Int
+stat = choice []
+
+-- 'choice' is deliberately out of scope in this test