From 53aa59f36dc6554c37ead9677c71e91cad3f9f21 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Wed, 3 Jul 2019 08:55:26 +0100 Subject: Add a missing zonk (fixes #16902) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the eager unifier, when unifying (tv1 ~ tv2), when we decide to swap them over, to unify (tv2 ~ tv1), I'd forgotten to ensure that tv1's kind was fully zonked, which is an invariant of uUnfilledTyVar2. That could lead us to build an infinite kind, or (in the case of #16902) update the same unification variable twice. Yikes. Now we get an error message rather than non-termination, which is much better. The error message is not great, but it's a very strange program, and I can't see an easy way to improve it, so for now I'm just committing this fix. Here's the decl data F (a :: k) :: (a ~~ k) => Type where MkF :: F a and the rather error message of which I am not proud T16902.hs:11:10: error: • Expected a type, but found something with kind ‘a1’ • In the type ‘F a’ --- testsuite/tests/polykinds/all.T | 1 + 1 file changed, 1 insertion(+) (limited to 'testsuite/tests/polykinds/all.T') diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 5a90ebe723..c67d80d621 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -211,3 +211,4 @@ test('T16221', normal, compile, ['']) test('T16221a', normal, compile_fail, ['']) test('T16342', normal, compile, ['']) test('T16263', normal, compile_fail, ['']) +test('T16902', normal, compile_fail, ['']) -- cgit v1.2.1