From 80e13ada20b68c5863c4bb2cb0c62e1698a75942 Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Mon, 7 Feb 2022 23:00:21 -0500 Subject: [PATCH] Build with 9.2 --- cabal-ghc921.project | 1 - ghcide/src/Development/IDE/GHC/Compat/Core.hs | 8 ++++++++ plugins/hls-alternate-number-format-plugin/README.md | 6 ++++++ .../hls-alternate-number-format-plugin.cabal | 2 +- .../src/Ide/Plugin/Literals.hs | 4 ++-- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cabal-ghc921.project b/cabal-ghc921.project index 308a9e8c8f..eb33bf0a99 100644 --- a/cabal-ghc921.project +++ b/cabal-ghc921.project @@ -44,7 +44,6 @@ constraints: -- These plugins don't build/work on GHC92 yet haskell-language-server +ignore-plugins-ghc-bounds - -alternateNumberFormat -brittany -class -eval diff --git a/ghcide/src/Development/IDE/GHC/Compat/Core.hs b/ghcide/src/Development/IDE/GHC/Compat/Core.hs index 2a593bbf73..9d4cf17e6f 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Core.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Core.hs @@ -141,6 +141,9 @@ module Development.IDE.GHC.Compat.Core ( ImportSpec(..), -- * SourceText SourceText(..), +#if !MIN_VERSION_ghc(9,2,0) + rationalFromFractionalLit, +#endif -- * Name tyThingParent_maybe, -- * Ways @@ -1076,3 +1079,8 @@ collectHsBindsBinders x = GHC.collectHsBindsBinders CollNoDictBinders x pattern HsLet xlet localBinds expr <- GHC.HsLet xlet (SrcLoc.unLoc -> localBinds) expr pattern LetStmt xlet localBinds <- GHC.LetStmt xlet (SrcLoc.unLoc -> localBinds) #endif + +#if !MIN_VERSION_ghc(9,2,0) +rationalFromFractionalLit :: FractionalLit -> Rational +rationalFromFractionalLit = fl_value +#endif diff --git a/plugins/hls-alternate-number-format-plugin/README.md b/plugins/hls-alternate-number-format-plugin/README.md index 5eb90c8a69..2bff086dfa 100644 --- a/plugins/hls-alternate-number-format-plugin/README.md +++ b/plugins/hls-alternate-number-format-plugin/README.md @@ -38,3 +38,9 @@ To generate suggestions, the plugin leverages the `Numeric` package which provid ## Changelog ### 1.0.0.0 - First Release + +### 1.0.1.0 +- Dependency upgrades + +### 1.0.1.1 +- Buildable with GHC 9.2 diff --git a/plugins/hls-alternate-number-format-plugin/hls-alternate-number-format-plugin.cabal b/plugins/hls-alternate-number-format-plugin/hls-alternate-number-format-plugin.cabal index 98b7552a13..ee07e3c3ce 100644 --- a/plugins/hls-alternate-number-format-plugin/hls-alternate-number-format-plugin.cabal +++ b/plugins/hls-alternate-number-format-plugin/hls-alternate-number-format-plugin.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-alternate-number-format-plugin -version: 1.0.1.0 +version: 1.0.1.1 synopsis: Provide Alternate Number Formats plugin for Haskell Language Server description: Please see the README on GitHub at diff --git a/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs b/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs index 59c4457648..2cc213fb08 100644 --- a/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs +++ b/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs @@ -85,7 +85,7 @@ fromIntegralLit :: RealSrcSpan -> IntegralLit -> Maybe Literal fromIntegralLit s IL{..} = fmap (\txt' -> IntLiteral s txt' il_value) (fromSourceText il_text) fromFractionalLit :: RealSrcSpan -> FractionalLit -> Maybe Literal -fromFractionalLit s FL{..} = fmap (\txt' -> FracLiteral s txt' fl_value) (fromSourceText fl_text) +fromFractionalLit s fl@FL{fl_text} = fmap (\txt' -> FracLiteral s txt' (rationalFromFractionalLit fl)) (fromSourceText fl_text) fromSourceText :: SourceText -> Maybe Text fromSourceText = \case @@ -116,5 +116,5 @@ literalToString = \case overLitToString :: OverLitVal -> String overLitToString = \case HsIntegral int -> case int of { IL{il_value} -> "IntegralOverLit: " <> show il_value} - HsFractional frac -> case frac of { FL{fl_value} -> "RationalOverLit: " <> show fl_value} + HsFractional frac -> case frac of { fl -> "RationalOverLit: " <> show (rationalFromFractionalLit fl)} HsIsString _ str -> "HIsString: " <> show str