summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-05-19 10:50:35 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-05-19 10:54:55 +0100
commit433b80dec1cfef787fc1327a9eada1791b11c12e (patch)
tree786621c3d42147db996738242d2c5492f8e0068e /testsuite/tests/gadt
parent7b52525ecb2a09b21e7e5393f45a72ed1dfa3bc8 (diff)
downloadhaskell-433b80dec1cfef787fc1327a9eada1791b11c12e.tar.gz
Ensure that insolubles are fully rewritten
I was alerted to this by Trac #12468 and #11325. We were treating insolubles (and "hole" constraints are treated as insoluble) inconsistently. In some places we were carefully rewriting them e.g. Note [Make sure that insolubles are fully rewritten] in TcCanonical. But in TcSimplify we weren't feeding them into the solver. As a result, "hole" constraints were not being rewritten, which some users found confusing, and I think rightly so. This patch also fixes a bug in TcSMonad.emitInsoluble, in which two different "hole" constriants could be treated (bogusly) as duplicates, thereby losing one.
Diffstat (limited to 'testsuite/tests/gadt')
-rw-r--r--testsuite/tests/gadt/T12468.hs9
-rw-r--r--testsuite/tests/gadt/T12468.stderr6
-rw-r--r--testsuite/tests/gadt/all.T1
3 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/T12468.hs b/testsuite/tests/gadt/T12468.hs
new file mode 100644
index 0000000000..a147c09fa6
--- /dev/null
+++ b/testsuite/tests/gadt/T12468.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE GADTs #-}
+
+module T12468 where
+
+data T a where
+ I :: T Int
+
+f :: T a -> a
+f I = _
diff --git a/testsuite/tests/gadt/T12468.stderr b/testsuite/tests/gadt/T12468.stderr
new file mode 100644
index 0000000000..729b5c45b0
--- /dev/null
+++ b/testsuite/tests/gadt/T12468.stderr
@@ -0,0 +1,6 @@
+
+T12468.hs:9:7: error:
+ • Found hole: _ :: Int
+ • In the expression: _
+ In an equation for ‘f’: f I = _
+ • Relevant bindings include f :: T a -> a (bound at T12468.hs:9:1)
diff --git a/testsuite/tests/gadt/all.T b/testsuite/tests/gadt/all.T
index d29fa8e4b0..877943b0c5 100644
--- a/testsuite/tests/gadt/all.T
+++ b/testsuite/tests/gadt/all.T
@@ -112,3 +112,4 @@ test('T7974', normal, compile, [''])
test('T7558', normal, compile_fail, [''])
test('T9096', normal, compile, [''])
test('T9380', normal, compile_and_run, [''])
+test('T12468', normal, compile_fail, [''])