[project @ 2001-09-07 13:38:55 by simonpj]
authorsimonpj <unknown>
Fri, 7 Sep 2001 13:38:55 +0000 (13:38 +0000)
committersimonpj <unknown>
Fri, 7 Sep 2001 13:38:55 +0000 (13:38 +0000)
Improve the error message for duplicate or invalid binders
in a binding group.

[Consequence: rnfail034 should not be an expected failure
      any more]

MERGE WITH STABLE BRANCH

ghc/compiler/rename/RnBinds.lhs

index 8cb0902..1ec05fa 100644 (file)
@@ -217,8 +217,7 @@ rnMonoBinds mbinds sigs     thing_inside -- Non-empty monobinds
   =    -- Extract all the binders in this group,
        -- and extend current scope, inventing new names for the new binders
        -- This also checks that the names form a set
-    bindLocatedLocalsRn (text "In a binding group") 
-                       mbinders_w_srclocs      $ \ new_mbinders ->
+    bindLocatedLocalsRn doc mbinders_w_srclocs $ \ new_mbinders ->
     let
        binder_set = mkNameSet new_mbinders
     in
@@ -246,6 +245,9 @@ rnMonoBinds mbinds sigs     thing_inside -- Non-empty monobinds
     returnRn (result, delListFromNameSet all_fvs new_mbinders)
   where
     mbinders_w_srclocs = collectLocatedMonoBinders mbinds
+    doc = text "In the binding group for" <+> pp_bndrs mbinders_w_srclocs
+    pp_bndrs [(b,_)] = quotes (ppr b)
+    pp_bndrs bs      = fsep (punctuate comma [ppr b | (b,_) <- bs])
 \end{code}