summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T14607.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-01-02 17:25:58 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2018-01-03 11:26:20 +0000
commit9e5535ca667e060ce1431d42cdfc3a13ae080a88 (patch)
treea5c4d04e651397eeb059e4a539c57e82f8aab779 /testsuite/tests/typecheck/should_fail/T14607.hs
parent112266ce62e4fa831b21038be72f8b9ecdf6bfcf (diff)
downloadhaskell-9e5535ca667e060ce1431d42cdfc3a13ae080a88.tar.gz
Fix OptCoercion
In the presence of -fdefer-type-errors, OptCoercion can encounter a mal-formed coerercion with type T a ~ T a b and that was causing a subsequent Lint error. This caused Trac #14607. Easily fixed by turning an ASSERT into a guard.
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T14607.hs')
-rw-r--r--testsuite/tests/typecheck/should_fail/T14607.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T14607.hs b/testsuite/tests/typecheck/should_fail/T14607.hs
new file mode 100644
index 0000000000..891d3ccc18
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T14607.hs
@@ -0,0 +1,23 @@
+{-# OPTIONS_GHC -fdefer-type-errors #-}
+ -- This line is crucial to the bug
+
+{-# Language GADTs #-}
+{-# Language InstanceSigs #-}
+{-# Language KindSignatures #-}
+{-# Language TypeFamilies #-}
+{-# Language DataKinds #-}
+{-# Language FlexibleInstances #-}
+
+module T14607 where
+
+import Data.Kind
+
+data LamCons :: Type -> Type -> () -> Type where
+ C :: LamCons a a '()
+
+class Mk a where
+ mk :: LamCons a a '()
+
+instance Mk a where
+ mk :: LamCons a '()
+ mk = mk