[commit: ghc] master: Fix litFitsInChar (54affce)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/54affcef5e0f269bdcca3c160e7d6bff065adb8c

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

commit 54affcef5e0f269bdcca3c160e7d6bff065adb8c
Author: Ian Lynagh <[email protected]>
Date:   Wed Sep 19 23:23:48 2012 +0100

    Fix litFitsInChar
    
    It was always False before

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

 compiler/basicTypes/Literal.lhs |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/compiler/basicTypes/Literal.lhs b/compiler/basicTypes/Literal.lhs
index 220ef9e..a590eae 100644
--- a/compiler/basicTypes/Literal.lhs
+++ b/compiler/basicTypes/Literal.lhs
@@ -351,10 +351,9 @@ litIsDupable dflags (LitInteger i _) = inIntRange dflags i
 litIsDupable _      _                = True
 
 litFitsInChar :: Literal -> Bool
-litFitsInChar (MachInt i)
-                         = fromInteger i <= ord minBound
-                        && fromInteger i >= ord maxBound
-litFitsInChar _         = False
+litFitsInChar (MachInt i) = i >= toInteger (ord minBound)
+                         && i <= toInteger (ord maxBound)
+litFitsInChar _           = False
 
 litIsLifted :: Literal -> Bool
 litIsLifted (LitInteger {}) = True
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.