From 3391a03562d4056de7b16cd0f632e6c43ae44cca Mon Sep 17 00:00:00 2001 From: Max Bolingbroke Date: Sun, 15 May 2011 18:50:54 +0100 Subject: Record the original text along with parsed Rationals: fixes #2245 --- compiler/deSugar/MatchLit.lhs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'compiler/deSugar/MatchLit.lhs') diff --git a/compiler/deSugar/MatchLit.lhs b/compiler/deSugar/MatchLit.lhs index be112e09a7..4842b16850 100644 --- a/compiler/deSugar/MatchLit.lhs +++ b/compiler/deSugar/MatchLit.lhs @@ -33,6 +33,7 @@ import Literal import SrcLoc import Data.Ratio import Outputable +import BasicTypes import Util import FastString \end{code} @@ -124,8 +125,8 @@ hsOverLitKey (OverLit { ol_val = l }) neg = litValKey l neg litValKey :: OverLitVal -> Bool -> Literal litValKey (HsIntegral i) False = MachInt i litValKey (HsIntegral i) True = MachInt (-i) -litValKey (HsFractional r) False = MachFloat r -litValKey (HsFractional r) True = MachFloat (-r) +litValKey (HsFractional r) False = MachFloat (fl_value r) +litValKey (HsFractional r) True = MachFloat (negate (fl_value r)) litValKey (HsIsString s) neg = ASSERT( not neg) MachStr s \end{code} @@ -190,8 +191,8 @@ tidyNPat tidy_lit_pat (OverLit val False _ ty) mb_neg _ mb_rat_lit = case (mb_neg, val) of (Nothing, HsIntegral i) -> Just (fromInteger i) (Just _, HsIntegral i) -> Just (fromInteger (-i)) - (Nothing, HsFractional f) -> Just f - (Just _, HsFractional f) -> Just (-f) + (Nothing, HsFractional f) -> Just (fl_value f) + (Just _, HsFractional f) -> Just (negate (fl_value f)) _ -> Nothing mb_str_lit :: Maybe FastString -- cgit v1.2.1