summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-10-19 16:52:47 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-27 14:02:34 -0400
commit0b3d23afcad8bc14f2ba69b8dbe05c314e6e7b29 (patch)
tree1851c76146d7de2e96d367213ec1cb7d2e134aaa /testsuite/tests/polykinds
parentf3d8ab2ef6ffe30ec91c795e0223392dd96ea61a (diff)
downloadhaskell-0b3d23afcad8bc14f2ba69b8dbe05c314e6e7b29.tar.gz
Fix two constraint solving problems
This patch fixes two problems in the constraint solver. * An actual bug #18555: we were floating out a constraint to eagerly, and that was ultimately fatal. It's explained in Note [Do not float blocked constraints] in GHC.Core.Constraint. This is all very delicate, but it's all going to become irrelevant when we stop floating constraints (#17656). * A major performance infelicity in the flattener. When flattening (ty |> co) we *never* generated Refl, even when there was nothing at all to do. Result: we would gratuitously rewrite the constraint to exactly the same thing, wasting work. Described in #18413, and came up again in #18855. Solution: exploit the special case by calling the new function castCoercionKind1. See Note [castCoercionKind1] in GHC.Core.Coercion
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/T18855.hs18
-rw-r--r--testsuite/tests/polykinds/all.T1
2 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T18855.hs b/testsuite/tests/polykinds/T18855.hs
new file mode 100644
index 0000000000..131cd9c8e7
--- /dev/null
+++ b/testsuite/tests/polykinds/T18855.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE StandaloneKindSignatures #-}
+{-# LANGUAGE TypeFamilies #-}
+module Bug where
+
+import Data.Kind
+
+type family Apply (f :: a -> b) (x :: a) :: b
+
+type F :: forall a.
+ forall (p :: forall bOne. Either a bOne -> Type)
+ -> forall bTwo.
+ forall (e :: Either a bTwo)
+ -> Apply p e
+
+type family F
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index b167b930dc..009172537b 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -225,3 +225,4 @@ test('T18451', normal, compile_fail, [''])
test('T18451a', normal, compile_fail, [''])
test('T18451b', normal, compile_fail, [''])
test('T18522-ppr', normal, ghci_script, ['T18522-ppr.script'])
+test('T18855', normal, compile, [''])