Commit 5c9c3660 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

The dict-bindings in an IPBinds need not be in dependency order

This appears to be a long-standing bug, discovered by BlueSpec 
(ravi@bluespec.com), Trac bug #795

The problem was that in an IP binding group, the dict bindings
aren't necessarily in dependency order; and if they aren't 
we get a core-lint error.

Test tc203 checks this case.  (Though whether it shows up at
all depends a bit on accidental factors of binding ordering.)
parent 1fc4b619
...@@ -85,7 +85,9 @@ dsValBinds (ValBindsOut binds _) body = foldrDs ds_val_bind body binds ...@@ -85,7 +85,9 @@ dsValBinds (ValBindsOut binds _) body = foldrDs ds_val_bind body binds
------------------------- -------------------------
dsIPBinds (IPBinds ip_binds dict_binds) body dsIPBinds (IPBinds ip_binds dict_binds) body
= do { prs <- dsLHsBinds dict_binds = do { prs <- dsLHsBinds dict_binds
; let inner = foldr (\(x,r) e -> Let (NonRec x r) e) body prs ; let inner = Let (Rec prs) body
-- The dict bindings may not be in
-- dependency order; hence Rec
; foldrDs ds_ip_bind inner ip_binds } ; foldrDs ds_ip_bind inner ip_binds }
where where
ds_ip_bind (L _ (IPBind n e)) body ds_ip_bind (L _ (IPBind n e)) body
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment