22set -xueo pipefail
33
44# Check that documentation was generated successfully
5- if [[ " $GHC_VERSION " = " 8.6.5" ]]; then
6- haddock_pkgs=" clash-lib clash-lib-hedgehog clash-cosim"
7- else
8- haddock_pkgs=" clash-prelude clash-prelude-hedgehog clash-lib clash-lib-hedgehog clash-cosim"
9- fi
5+ haddock_pkgs=" clash-prelude clash-prelude-hedgehog clash-lib clash-lib-hedgehog clash-cosim"
106
117mkdir -p hadocs
128
@@ -16,9 +12,20 @@ for pkg in ${haddock_pkgs}; do
1612 # Cache dependencies
1713 cabal v2-build ${pkg} -O0 --enable-documentation --only-dependencies
1814
19- # HaskellPrelude yields warnings we cannot fix
15+ # The preludes yield link destination warnings we cannot fix. Maybe fixed by:
16+ # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/14447?
17+ #
18+ # Some other modules complain about ambiguous identifiers, but they're
19+ # complaining about identifiers in temporary files, i.e. some Haddock
20+ # implementation detail.
2021 cabal v2-haddock ${pkg} -O0 --enable-documentation \
21- | & grep -v " Clash.HaskellPrelude" \
22+ | & grep -v " Warning: Clash.HaskellPrelude: could not find link destinations for" \
23+ | & grep -v " Warning: Clash.Explicit.Prelude.Safe: could not find link destinations for" \
24+ | & grep -v " Warning: Clash.Prelude.Safe: could not find link destinations for" \
25+ | & grep -v " Warning: Clash.Explicit.Prelude: could not find link destinations for" \
26+ | & grep -v " Warning: Clash.Prelude: could not find link destinations for" \
27+ | & grep -v " Warning: 'SNat' is ambiguous. It is defined" \
28+ | & grep -v " Warning: 'head' is ambiguous. It is defined" \
2229 | tee haddock_log
2330
2431 set +e
@@ -53,8 +60,8 @@ for pkg in ${haddock_pkgs}; do
5360 exit 1
5461 fi
5562
56- ambiguous_warn=" You may be able to disambiguate the identifier by "
57- if grep -q " ${ambiguous_warn} " haddock_log; then
63+ ambiguous_warn=" ^Warning: '.*' is ambiguous. It is defined "
64+ if grep -E - q " ${ambiguous_warn} " haddock_log; then
5865 echo -e " \e[1m\e[31mAmbiguous identifier found in ${pkg} ! Scroll up for full log.\e[0m"
5966 grep --color=always -n -C 5 " ${ambiguous_warn} " haddock_log
6067 exit 1
0 commit comments