diff options
author | Nolan <nolane16@gmail.com> | 2017-05-08 17:46:22 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-05-08 17:46:24 -0400 |
commit | 0279b745c29213c479b61f864ca5d3d2ae76ac77 (patch) | |
tree | 6f5fb39ddcdb142f017e9196ddc480971eb661ae /compiler/typecheck/TcHsSyn.hs | |
parent | dc3b4af6d0c38ced4f0becf575474a1c1b08f794 (diff) | |
download | haskell-0279b745c29213c479b61f864ca5d3d2ae76ac77.tar.gz |
Make XNegativeLiterals treat -0.0 as negative 0
Reviewers: austin, goldfire, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, mpickering
GHC Trac Issues: #13211
Differential Revision: https://phabricator.haskell.org/D3543
Diffstat (limited to 'compiler/typecheck/TcHsSyn.hs')
-rw-r--r-- | compiler/typecheck/TcHsSyn.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index 6ad2b281f9..1b9fed98b6 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -18,7 +18,6 @@ module TcHsSyn ( -- * Other HsSyn functions mkHsDictLet, mkHsApp, mkHsAppTy, mkHsCaseAlt, - nlHsIntLit, shortCutLit, hsOverLitName, conLikeResTy, @@ -112,7 +111,7 @@ hsLitType (HsChar _ _) = charTy hsLitType (HsCharPrim _ _) = charPrimTy hsLitType (HsString _ _) = stringTy hsLitType (HsStringPrim _ _) = addrPrimTy -hsLitType (HsInt _ _) = intTy +hsLitType (HsInt _) = intTy hsLitType (HsIntPrim _ _) = intPrimTy hsLitType (HsWordPrim _ _) = wordPrimTy hsLitType (HsInt64Prim _ _) = int64PrimTy @@ -125,12 +124,11 @@ hsLitType (HsDoublePrim _) = doublePrimTy -- Overloaded literals. Here mainly because it uses isIntTy etc shortCutLit :: DynFlags -> OverLitVal -> TcType -> Maybe (HsExpr TcId) -shortCutLit dflags (HsIntegral src i) ty - | isIntTy ty && inIntRange dflags i = Just (HsLit (HsInt src i)) - | isWordTy ty && inWordRange dflags i - = Just (mkLit wordDataCon (HsWordPrim src i)) +shortCutLit dflags (HsIntegral int@(IL src neg i)) ty + | isIntTy ty && inIntRange dflags i = Just (HsLit (HsInt int)) + | isWordTy ty && inWordRange dflags i = Just (mkLit wordDataCon (HsWordPrim src i)) | isIntegerTy ty = Just (HsLit (HsInteger src i ty)) - | otherwise = shortCutLit dflags (HsFractional (integralFractionalLit i)) ty + | otherwise = shortCutLit dflags (HsFractional (integralFractionalLit neg i)) ty -- The 'otherwise' case is important -- Consider (3 :: Float). Syntactically it looks like an IntLit, -- so we'll call shortCutIntLit, but of course it's a float |