From: simonpj Date: Wed, 13 Jul 2005 10:16:11 +0000 (+0000) Subject: [project @ 2005-07-13 10:16:11 by simonpj] X-Git-Tag: Initial_conversion_from_CVS_complete~355 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=6a6653c0dcff0eb8351b1c4fc36443b14ba20dd0;p=ghc-hetmet.git [project @ 2005-07-13 10:16:11 by simonpj] MERGE to STABLE Switch the order of equations generated by FunDeps.improve, so that the error messages are more perspicuous. This fixes SourceForge [ ghc-Bugs-1234239 ] "Bad location for violation of functional dependency" tcfail143 tests. --- diff --git a/ghc/compiler/types/FunDeps.lhs b/ghc/compiler/types/FunDeps.lhs index af42ee9..f0a97c3 100644 --- a/ghc/compiler/types/FunDeps.lhs +++ b/ghc/compiler/types/FunDeps.lhs @@ -245,7 +245,15 @@ checkGroup inst_env clss@((ClassP cls _, _) : _) -- -- We need to do something very similar comparing each predicate -- with relevant instance decls - pairwise_eqns ++ instance_eqns + + instance_eqns ++ pairwise_eqns + -- NB: we put the instance equations first. This biases the + -- order so that we first improve individual constraints against the + -- instances (which are perhaps in a library and less likely to be + -- wrong; and THEN perform the pairwise checks. + -- The other way round, it's possible for the pairwise check to succeed + -- and cause a subsequent, misleading failure of one of the pair with an + -- instance declaration. See tcfail143.hs for an exmample where (cls_tvs, cls_fds) = classTvsFds cls