summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-05-23 07:47:17 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2014-05-23 07:49:13 +0100
commitd8d97113c24e7216be36c9cdfc58e91f26528f06 (patch)
treed1bf8d2c7ead0d63dbefd36dbecb2143905e8802 /testsuite
parentbc58d2e8a9da7cab90e4a06c28197d1d746a06cf (diff)
downloadhaskell-d8d97113c24e7216be36c9cdfc58e91f26528f06.tar.gz
Make the unifier a fixpoint even for the free kind vars of a tyvar
The (pure) unifier tcUnifyTys returns an idempotent substitution. But previously the kinds of type variables free in the range of the subst could have un-substituted kind variables. This patch fixes that, fixing Trac #9106. See Note [Finding the substitution fixpoint] in Unify
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/polykinds/T9106.hs14
-rw-r--r--testsuite/tests/polykinds/T9106.stderr8
-rw-r--r--testsuite/tests/polykinds/all.T1
3 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T9106.hs b/testsuite/tests/polykinds/T9106.hs
new file mode 100644
index 0000000000..eaf0364235
--- /dev/null
+++ b/testsuite/tests/polykinds/T9106.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE MultiParamTypeClasses, DataKinds, FunctionalDependencies,
+ KindSignatures, PolyKinds, FlexibleInstances, FlexibleContexts,
+ UndecidableInstances #-}
+
+module T9106 where
+
+import GHC.TypeLits
+
+class FunctorN (n :: Nat) f (a :: *) (fa :: *) | n f a -> fa where
+
+instance FunctorN 0 f a a where
+
+instance FunctorN n f a (f fa)
+
diff --git a/testsuite/tests/polykinds/T9106.stderr b/testsuite/tests/polykinds/T9106.stderr
new file mode 100644
index 0000000000..0b239f2ea4
--- /dev/null
+++ b/testsuite/tests/polykinds/T9106.stderr
@@ -0,0 +1,8 @@
+
+T9106.hs:13:10:
+ Illegal instance declaration for ‘FunctorN n f a (f fa)’
+ The liberal coverage condition fails in class ‘FunctorN’
+ for functional dependency: ‘n f a -> fa’
+ Reason: lhs types ‘n’, ‘f’, ‘a’
+ do not jointly determine rhs type ‘f fa’
+ In the instance declaration for ‘FunctorN n f a (f fa)’
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 3634d83537..96faa6725b 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -100,3 +100,4 @@ test('T8566a', expect_broken(8566), compile,[''])
test('T7481', normal, compile_fail,[''])
test('T8705', normal, compile, [''])
test('T8985', normal, compile, [''])
+test('T9106', normal, compile_fail, [''])