From 6113955d352ba7188a7ae3b4de24c396dff86495 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Thu, 28 Jun 2007 07:36:41 +0000 Subject: [PATCH] Improve error message when there is instance overlap --- compiler/types/InstEnv.lhs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/types/InstEnv.lhs b/compiler/types/InstEnv.lhs index 560c4fc..7aaea5c 100644 --- a/compiler/types/InstEnv.lhs +++ b/compiler/types/InstEnv.lhs @@ -430,10 +430,11 @@ lookupInstEnv (pkg_ie, home_ie) cls tys (pkg_matches, pkg_unifs) = lookup pkg_ie all_matches = home_matches ++ pkg_matches all_unifs = home_unifs ++ pkg_unifs - pruned_matches - | null all_unifs = foldr insert_overlapping [] all_matches - | otherwise = all_matches -- Non-empty unifs is always an error situation, - -- so don't attempt to pune the matches + pruned_matches = foldr insert_overlapping [] all_matches + -- Even if the unifs is non-empty (an error situation) + -- we still prune the matches, so that the error message isn't + -- misleading (complaining of multiple matches when some should be + -- overlapped away) -------------- lookup env = case lookupUFM env cls of -- 1.7.10.4