diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2021-01-20 16:24:14 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-02-27 08:00:08 -0500 |
commit | 60bf4d7ca59e333db6349948b8140651d0190004 (patch) | |
tree | 706809fce670feb8b5799bebbf95c379593ec2f3 /compiler/GHC/Builtin | |
parent | 966a768e9b99e72c9d98a1c971427044888d6de9 (diff) | |
download | haskell-60bf4d7ca59e333db6349948b8140651d0190004.tar.gz |
Fix typechecking time bug for large rationals (#15646)
When desugaring large overloaded literals we now avoid
computing the `Rational` value. Instead prefering to
store the significant and exponent as given where
reasonable and possible.
See Note [FractionalLit representation] for details.
Diffstat (limited to 'compiler/GHC/Builtin')
-rw-r--r-- | compiler/GHC/Builtin/Names.hs | 15 | ||||
-rw-r--r-- | compiler/GHC/Builtin/Types.hs | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs index fc0589730a..563ccbf57e 100644 --- a/compiler/GHC/Builtin/Names.hs +++ b/compiler/GHC/Builtin/Names.hs @@ -266,6 +266,7 @@ basicKnownKeyNames -- Numeric stuff negateName, minusName, geName, eqName, + mkRationalBase2Name, mkRationalBase10Name, -- Conversion functions rationalTyConName, @@ -1340,7 +1341,7 @@ integerShiftRName = bniVarQual "integerShiftR#" integerShiftR rationalTyConName, ratioTyConName, ratioDataConName, realClassName, integralClassName, realFracClassName, fractionalClassName, fromRationalName, toIntegerName, toRationalName, fromIntegralName, - realToFracName :: Name + realToFracName, mkRationalBase2Name, mkRationalBase10Name :: Name rationalTyConName = tcQual gHC_REAL (fsLit "Rational") rationalTyConKey ratioTyConName = tcQual gHC_REAL (fsLit "Ratio") ratioTyConKey ratioDataConName = dcQual gHC_REAL (fsLit ":%") ratioDataConKey @@ -1353,7 +1354,8 @@ toIntegerName = varQual gHC_REAL (fsLit "toInteger") toIntegerClassOpKe toRationalName = varQual gHC_REAL (fsLit "toRational") toRationalClassOpKey fromIntegralName = varQual gHC_REAL (fsLit "fromIntegral")fromIntegralIdKey realToFracName = varQual gHC_REAL (fsLit "realToFrac") realToFracIdKey - +mkRationalBase2Name = varQual gHC_REAL (fsLit "mkRationalBase2") mkRationalBase2IdKey +mkRationalBase10Name = varQual gHC_REAL (fsLit "mkRationalBase10") mkRationalBase10IdKey -- PrelFloat classes floatingClassName, realFloatClassName :: Name floatingClassName = clsQual gHC_FLOAT (fsLit "Floating") floatingClassKey @@ -2711,6 +2713,15 @@ naturalSizeInBaseIdKey = mkPreludeMiscIdUnique 684 bignatFromWordListIdKey = mkPreludeMiscIdUnique 690 +------------------------------------------------------ +-- ghci optimization for big rationals 700-749 uniques +------------------------------------------------------ + +-- Creating rationals at runtime. +mkRationalBase2IdKey, mkRationalBase10IdKey :: Unique +mkRationalBase2IdKey = mkPreludeMiscIdUnique 700 +mkRationalBase10IdKey = mkPreludeMiscIdUnique 701 :: Unique + {- ************************************************************************ * * diff --git a/compiler/GHC/Builtin/Types.hs b/compiler/GHC/Builtin/Types.hs index 924ce6648d..1a3550fcaa 100644 --- a/compiler/GHC/Builtin/Types.hs +++ b/compiler/GHC/Builtin/Types.hs @@ -1959,8 +1959,6 @@ extractPromotedList tys = go tys | otherwise = pprPanic "extractPromotedList" (ppr tys) - - --------------------------------------- -- ghc-bignum --------------------------------------- |