Skip to content

Commit 5a28ec7

Browse files
Compile clash-ghc warning free on GHC 9.12
1 parent ebd270c commit 5a28ec7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

clash-ghc/src-ghc/Clash/GHC/GHC2Core.hs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,11 @@ coreToTerm primMap unlocs = term
692692
LitFloat r -> C.FloatLiteral . floatToWord $ fromRational r
693693
LitDouble r -> C.DoubleLiteral . doubleToWord $ fromRational r
694694
LitNullAddr -> C.StringLiteral []
695+
#if MIN_VERSION_ghc(9,12,0)
696+
LitLabel fs _ -> C.StringLiteral (unpackFS fs)
697+
#else
695698
LitLabel fs _ _ -> C.StringLiteral (unpackFS fs)
699+
#endif
696700

697701
addUsefull :: SrcSpan
698702
-> C2C a
@@ -746,6 +750,7 @@ hasPrimCo (ForAllCo {fco_body = co}) = hasPrimCo co
746750
hasPrimCo (ForAllCo _ _ co) = hasPrimCo co
747751
#endif
748752

753+
#if !MIN_VERSION_ghc(9,12,0)
749754
hasPrimCo co@(AxiomInstCo _ _ coers) = do
750755
let (Pair ty1 _) = coercionKind co
751756
ty1PM <- isPrimTc ty1
@@ -764,6 +769,7 @@ hasPrimCo co@(AxiomInstCo _ _ coers) = do
764769
,"Clash.Sized.Internal.Unsigned.Unsigned"
765770
])
766771
isPrimTc _ = return False
772+
#endif
767773

768774
hasPrimCo (SymCo co) = hasPrimCo co
769775

@@ -773,7 +779,11 @@ hasPrimCo (TransCo co1 co2) = do
773779
Just _ -> return tc1M
774780
_ -> hasPrimCo co2
775781

782+
#if MIN_VERSION_ghc(9,12,0)
783+
hasPrimCo (AxiomCo _ coers) = do
784+
#else
776785
hasPrimCo (AxiomRuleCo _ coers) = do
786+
#endif
777787
tcs <- catMaybes <$> mapM hasPrimCo coers
778788
return (listToMaybe tcs)
779789

@@ -786,7 +796,13 @@ hasPrimCo (LRCo _ co) = hasPrimCo co
786796
hasPrimCo (InstCo co _) = hasPrimCo co
787797
hasPrimCo (SubCo co) = hasPrimCo co
788798

789-
hasPrimCo _ = return Nothing
799+
hasPrimCo (Refl {}) = return Nothing
800+
hasPrimCo (GRefl {}) = return Nothing
801+
hasPrimCo (FunCo {}) = return Nothing
802+
hasPrimCo (CoVarCo {}) = return Nothing
803+
hasPrimCo (UnivCo {}) = return Nothing
804+
hasPrimCo (KindCo {}) = return Nothing
805+
hasPrimCo (HoleCo {}) = return Nothing
790806

791807
coreToDataCon :: DataCon
792808
-> C2C C.DataCon

0 commit comments

Comments
 (0)