Fix the desugaring of guards in arrow syntax
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 9 May 2011 15:44:30 +0000 (16:44 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 9 May 2011 15:44:30 +0000 (16:44 +0100)
This was making T3822 fail, which it has apparently been doing
for some time (ie in GHC 7, 6.12, 6.10)!

compiler/deSugar/Coverage.lhs

index 8071da7..37cbc2d 100644 (file)
@@ -608,9 +608,12 @@ addTickCmdGRHSs (GRHSs guarded local_binds) = do
     binders = collectLocalBinders local_binds
 
 addTickCmdGRHS :: GRHS Id -> TM (GRHS Id)
-addTickCmdGRHS (GRHS stmts cmd) = do
-  (stmts',expr') <- addTickLCmdStmts' stmts (addTickLHsCmd cmd)
-  return $ GRHS stmts' expr'
+-- The *guards* are *not* Cmds, although the body is
+-- C.f. addTickGRHS for the BinBox stuff
+addTickCmdGRHS (GRHS stmts cmd)
+  = do { (stmts',expr') <- addTickLStmts' (Just $ BinBox $ GuardBinBox) 
+                                   stmts (addTickLHsCmd cmd)
+       ; return $ GRHS stmts' expr' }
 
 addTickLCmdStmts :: [LStmt Id] -> TM [LStmt Id]
 addTickLCmdStmts stmts = do