Skip to content

Commit 504755a

Browse files
authored
Merge pull request #2604 from clash-lang/fix_doctest_ghc_9_6
Fix doctest on GHC 9.2-9.6 without multiple hidden
2 parents ef85184 + 62fcdcf commit 504755a

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ write-ghc-environment-files: always
1616
-- index state, to go along with the cabal.project.freeze file. update the index
1717
-- state by running `cabal update` twice and looking at the index state it
1818
-- displays to you (as the second update will be a no-op)
19-
index-state: 2023-09-12T05:36:44Z
19+
index-state: 2023-10-18T12:11:41Z
2020

2121
-- For some reason the `clash-testsuite` executable fails to run without
2222
-- this, as it cannot find the related library...

clash-prelude/clash-prelude.cabal

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,15 @@ test-suite doctests
385385
build-depends:
386386
base,
387387
clash-prelude,
388-
doctest-parallel >= 0.2 && < 0.4,
388+
doctest-parallel >= 0.3.1 && < 0.4,
389389
filepath
390390

391391
if flag(workaround-ghc-mmap-crash)
392392
ghc-options: -with-rtsopts=-xm20000000
393393

394+
if flag(multiple-hidden)
395+
CPP-Options: -DCLASH_MULTIPLE_HIDDEN
396+
394397

395398
test-suite unittests
396399
import: common-options

clash-prelude/src/Clash/Prelude/BlockRam.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,13 @@ readNew (blockRam (0 :> 1 :> Nil))
846846
... =>
847847
Signal dom addr -> Signal dom (Maybe (addr, a)) -> Signal dom a
848848
849+
#elif __GLASGOW_HASKELL__ >= 902 && !defined(CLASH_MULTIPLE_HIDDEN)
850+
>>> :t readNew (blockRam (0 :> 1 :> Nil))
851+
readNew (blockRam (0 :> 1 :> Nil))
852+
:: ...
853+
... =>
854+
Signal dom addr -> Signal dom (Maybe (addr, a)) -> Signal dom a
855+
849856
#else
850857
>>> :t readNew (blockRam (0 :> 1 :> Nil))
851858
readNew (blockRam (0 :> 1 :> Nil))

clash-prelude/tests/doctests.hs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
{-# LANGUAGE CPP #-}
12
module Main where
23

3-
import System.Environment (getArgs)
44
import Test.DocTest (mainFromCabal)
5+
import System.Environment (getArgs)
56

67
main :: IO ()
7-
main = mainFromCabal "clash-prelude" =<< getArgs
8+
main = mainFromCabal "clash-prelude" =<< fmap (extraArgs ++) getArgs
9+
10+
extraArgs :: [String]
11+
extraArgs = map ("--ghc-arg=" ++)
12+
[
13+
#if __GLASGOW_HASKELL__ >= 904
14+
"-DCLASH_OPAQUE=OPAQUE"
15+
#else
16+
"-DCLASH_OPAQUE=NOINLINE"
17+
#endif
18+
#ifdef CLASH_MULTIPLE_HIDDEN
19+
, "-DCLASH_MULTIPLE_HIDDEN"
20+
#endif
21+
]

nix/overlay.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ let
4848
"ghc-typelits-natnormalise"
4949
"${ghc-typelits-natnormalise}"
5050
{ };
51+
# doctest-parallel = hprev.callHackage "doctest-parallel" "0.3.1" { };
52+
doctest-parallel = hprev.callHackageDirect { pkg = "doctest-parallel"; ver = "0.3.1"; sha256 = "sha256-j0mk4RTEau6Cl90E8vMWZiA/ldRRurtLSYbGGE+q/vk="; } {};
5153
};
5254

5355
# An overlay with the packages in this repository.

0 commit comments

Comments
 (0)