Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/777b8c4bd6f8a76f2fd365aa43451b7af098e9ef

>---------------------------------------------------------------

commit 777b8c4bd6f8a76f2fd365aa43451b7af098e9ef
Author: Simon Peyton Jones <[email protected]>
Date:   Mon Jun 13 15:03:38 2011 +0100

    Don't allow specialisation of class methods (fixes Trac #5001)
    
    It doesn't make sense to specialise class methods -- their
    code is simply a record selector.  Moreover, such methods
    don't (currently) have an inl_sat field in their InlinePragma
    which made DsBinds.makeCoreArity bleat.
    
    This patch just ignores such pragmas, with a warning.

>---------------------------------------------------------------

 compiler/deSugar/DsBinds.lhs |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/compiler/deSugar/DsBinds.lhs b/compiler/deSugar/DsBinds.lhs
index 65cb815..39e7e29 100644
--- a/compiler/deSugar/DsBinds.lhs
+++ b/compiler/deSugar/DsBinds.lhs
@@ -493,6 +493,15 @@ dsSpec :: Maybe CoreExpr   -- Just rhs => RULE is for a 
local binding
        -> Located TcSpecPrag
        -> DsM (Maybe (OrdList (Id,CoreExpr), CoreRule))
 dsSpec mb_poly_rhs (L loc (SpecPrag poly_id spec_co spec_inl))
+  | isJust (isClassOpId_maybe poly_id)
+  = putSrcSpanDs loc $ 
+    do { warnDs (ptext (sLit "Ignoring useless SPECIALISE pragma for class 
method selector") 
+                 <+> quotes (ppr poly_id))
+       ; return Nothing  }  -- There is no point in trying to specialise a 
class op
+                                   -- Moreover, classops don't (currently) 
have an inl_sat arity set
+                           -- (it would be Just 0) and that in turn makes 
makeCorePair bleat
+
+  | otherwise
   = putSrcSpanDs loc $ 
     do { let poly_name = idName poly_id
        ; spec_name <- newLocalName poly_name



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to