diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c66bf..837ec49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog for the [`ghc-typelits-knownnat`](http://hackage.haskell.org/package/ghc-typelits-knownnat) package +## 0.7.11 +* Fix infinite loop between plugin and solver pipeline + ## 0.7.10 *November 14th 2023* * Work around [GHC issue 23109](https://gitlab.haskell.org/ghc/ghc/-/issues/23109) diff --git a/ghc-typelits-knownnat.cabal b/ghc-typelits-knownnat.cabal index c8254fb..85a9a26 100644 --- a/ghc-typelits-knownnat.cabal +++ b/ghc-typelits-knownnat.cabal @@ -1,5 +1,5 @@ name: ghc-typelits-knownnat -version: 0.7.10 +version: 0.7.11 synopsis: Derive KnownNat constraints from other KnownNat constraints description: A type checker plugin for GHC that can derive \"complex\" @KnownNat@ diff --git a/src-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs b/src-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs index 299030c..1838e82 100644 --- a/src-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs +++ b/src-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs @@ -493,6 +493,7 @@ constraintToEvTerm defs givens (ct,cls,op,orig) = do -- Find a known constraint for a wanted, so that (modulo normalization) -- the two are a constant offset apart. offset :: Type -> TcPluginM (Maybe (EvTerm,[Ct])) + offset LitTy{} = pure Nothing offset want = runMaybeT $ do let -- Get the knownnat contraints unKn ty' = case classifyPredType ty' of diff --git a/src-pre-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs b/src-pre-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs index e07c2e8..ebc3a35 100644 --- a/src-pre-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs +++ b/src-pre-ghc-9.4/GHC/TypeLits/KnownNat/Solver.hs @@ -579,6 +579,7 @@ constraintToEvTerm defs givens (ct,cls,op,orig) = do -- Find a known constraint for a wanted, so that (modulo normalization) -- the two are a constant offset apart. offset :: Type -> TcPluginM (Maybe (EvTerm,[Ct])) + offset LitTy{} = pure Nothing offset want = runMaybeT $ do let -- Get the knownnat contraints unKn ty' = case classifyPredType ty' of