diff --git a/.gitignore b/.gitignore index 8ee1bf9..d7e4614 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .stack-work +dist-newstyle diff --git a/CHANGELOG.md b/CHANGELOG.md index ad33ad8..2954a5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog for the [`ghc-typelits-extra`](http://hackage.haskell.org/package/ghc-typelits-extra) package +# Unreleased +* Fix faulty lookup for `Mod` and `Div` in GHC >= 9.2 + # 0.4.7 * Fix Plugin silently fails when normalizing <= in GHC 9.4+ [#50](https://github.com/clash-lang/ghc-typelits-extra/issues/50) diff --git a/src-ghc-9.4/GHC/TypeLits/Extra/Solver.hs b/src-ghc-9.4/GHC/TypeLits/Extra/Solver.hs index 80340a9..8fe3db5 100644 --- a/src-ghc-9.4/GHC/TypeLits/Extra/Solver.hs +++ b/src-ghc-9.4/GHC/TypeLits/Extra/Solver.hs @@ -32,8 +32,7 @@ import GHC.TcPluginM.Extra import GHC.Builtin.Names (eqPrimTyConKey, hasKey, getUnique) import GHC.Builtin.Types (promotedTrueDataCon, promotedFalseDataCon) import GHC.Builtin.Types (boolTy, naturalTy, cTupleDataCon, cTupleTyCon) -import GHC.Builtin.Types.Literals (typeNatTyCons) -import GHC.Builtin.Types.Literals (typeNatCmpTyCon) +import GHC.Builtin.Types.Literals (typeNatDivTyCon, typeNatModTyCon, typeNatCmpTyCon) import GHC.Core.Coercion (mkUnivCo) import GHC.Core.DataCon (dataConWrapId) import GHC.Core.Predicate (EqRel (NomEq), Pred (EqPred, IrredPred), classifyPredType) @@ -315,8 +314,8 @@ lookupExtraDefs = do md2 <- lookupModule typeErrModule basePackage ExtraDefs <$> look md "Max" <*> look md "Min" - <*> pure (typeNatTyCons !! 5) - <*> pure (typeNatTyCons !! 6) + <*> pure typeNatDivTyCon + <*> pure typeNatModTyCon <*> look md "FLog" <*> look md "CLog" <*> look md "Log" diff --git a/src-pre-ghc-9.4/GHC/TypeLits/Extra/Solver.hs b/src-pre-ghc-9.4/GHC/TypeLits/Extra/Solver.hs index 1ad5d3b..3d9a9d3 100644 --- a/src-pre-ghc-9.4/GHC/TypeLits/Extra/Solver.hs +++ b/src-pre-ghc-9.4/GHC/TypeLits/Extra/Solver.hs @@ -42,7 +42,7 @@ import GHC.Builtin.Types (boolTy, naturalTy) #else import GHC.Builtin.Types (typeNatKind) #endif -import GHC.Builtin.Types.Literals (typeNatTyCons) +import GHC.Builtin.Types.Literals (typeNatDivTyCon, typeNatModTyCon) #if MIN_VERSION_ghc(9,2,0) import GHC.Builtin.Types.Literals (typeNatCmpTyCon) #else @@ -82,7 +82,7 @@ import TyCoRep (Type (..)) import TysWiredIn (typeNatKind, promotedTrueDataCon, promotedFalseDataCon) import TcTypeNats (typeNatLeqTyCon) #if MIN_VERSION_ghc(8,4,0) -import TcTypeNats (typeNatTyCons) +import TcTypeNats (typeNatDivTyCon, typeNatModTyCon) #else import TcPluginM (zonkCt) #endif @@ -313,8 +313,8 @@ lookupExtraDefs = do ExtraDefs <$> look md "Max" <*> look md "Min" #if MIN_VERSION_ghc(8,4,0) - <*> pure (typeNatTyCons !! 5) - <*> pure (typeNatTyCons !! 6) + <*> pure typeNatDivTyCon + <*> pure typeNatModTyCon #else <*> look md "Div" <*> look md "Mod"