Add missing case for eq_note.
[ghc-hetmet.git] / compiler / specialise / Rules.lhs
index 0cf7a44..028ec83 100644 (file)
@@ -488,9 +488,10 @@ match menv subst (Var v1) e2
   | Just subst <- match_var menv subst v1 e2
   = Just subst
 
-match menv subst e1 (Note _ e2)
-  = match menv subst e1 e2
-       -- See Note [Notes in RULE matching]
+match menv subst (Note _ e1) e2 = match menv subst e1 e2
+match menv subst e1 (Note _ e2) = match menv subst e1 e2
+      -- Ignore notes in both template and thing to be matched
+      -- See Note [Notes in RULE matching]
 
 match menv subst e1 (Var v2)      -- Note [Expanding variables]
   | not (locallyBoundR rn_env v2) -- Note [Do not expand locally-bound variables]
@@ -566,7 +567,7 @@ match menv subst (Cast e1 co1) (Cast e2 co2)
        ; match menv subst1 e1 e2 }
 
 -- Everything else fails
-match _ _ _e1 _e2 = -- pprTrace "Failing at" ((text "e1:" <+> ppr e1) $$ (text "e2:" <+> ppr e2)) $ 
+match _ _ _e1 _e2 = -- pprTrace "Failing at" ((text "e1:" <+> ppr _e1) $$ (text "e2:" <+> ppr _e2)) $ 
                         Nothing
 
 ------------------------------------------
@@ -684,11 +685,11 @@ Hence, (a) the guard (not (isLocallyBoundR v2))
 
 Note [Notes in RULE matching]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Look through Notes.  In particular, we don't want to
-be confused by InlineMe notes.  Maybe we should be more
-careful about profiling notes, but for now I'm just
-riding roughshod over them.  
-See Note [Notes in call patterns] in SpecConstr
+Look through Notes in both template and expression being matched.  In
+particular, we don't want to be confused by InlineMe notes.  Maybe we
+should be more careful about profiling notes, but for now I'm just
+riding roughshod over them.  cf Note [Notes in call patterns] in
+SpecConstr
 
 Note [Matching lets]
 ~~~~~~~~~~~~~~~~~~~~
@@ -827,6 +828,7 @@ eq_alt env (c1,vs1,r1) (c2,vs2,r2) = c1==c2 && eqExpr (rnBndrs2 env vs1  vs2) r1
 eq_note :: RnEnv2 -> Note -> Note -> Bool
 eq_note _ (SCC cc1)     (SCC cc2)      = cc1 == cc2
 eq_note _ (CoreNote s1) (CoreNote s2)  = s1 == s2
+eq_note _ (InlineMe)    (InlineMe)     = True
 eq_note _ _             _              = False
 \end{code}