From abc45a98629e11d86c339cca64c3a4575b9c0f5e Mon Sep 17 00:00:00 2001 From: panne Date: Sat, 22 Apr 2000 14:30:51 +0000 Subject: [PATCH] [project @ 2000-04-22 14:30:51 by panne] Don't use coercion RULES with litlits (e.g. int2Word ``42''), once again found by *the* GHC test, HOpenGL + Quake level viewer. :-) --- ghc/compiler/prelude/PrelRules.lhs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/prelude/PrelRules.lhs b/ghc/compiler/prelude/PrelRules.lhs index c7d5e1a..0cc8c2b 100644 --- a/ghc/compiler/prelude/PrelRules.lhs +++ b/ghc/compiler/prelude/PrelRules.lhs @@ -15,7 +15,7 @@ module PrelRules ( primOpRule, builtinRules ) where import CoreSyn import Rules ( ProtoCoreRule(..) ) import Id ( idUnfolding, mkWildId, isDataConId_maybe ) -import Literal ( Literal(..), mkMachInt, mkMachWord, inIntRange, literalType, +import Literal ( Literal(..), isLitLitLit, mkMachInt, mkMachWord, inIntRange, literalType, word2IntLit, int2WordLit, int2CharLit, char2IntLit, int2FloatLit, int2DoubleLit ) import PrimOp ( PrimOp(..), primOpOcc ) @@ -141,7 +141,8 @@ why we have the catch-all Nothing case. \begin{code} -------------------------- litCoerce :: (Literal -> Literal) -> RuleName -> Literal -> Maybe (RuleName, CoreExpr) -litCoerce fn name lit = Just (name, Lit (fn lit)) +litCoerce fn name lit | isLitLitLit lit = Nothing + | otherwise = Just (name, Lit (fn lit)) -------------------------- cmpOp :: (Ordering -> Bool) -> FAST_STRING -> Literal -> Literal -> Maybe (RuleName, CoreExpr) -- 1.7.10.4