@@ -866,25 +866,32 @@ renderPureArgs version comp platform args =
866
866
, [" --since-qual=external" | isVersion 2 20 ]
867
867
, [ " --quickjump" | isVersion 2 19 , True <- flagToList . argQuickJump $ args
868
868
]
869
- , [ " --hyperlinked-source" | isVersion 2 17 , True <- flagToList . argLinkedSource $ args
870
- ]
869
+ , [" --hyperlinked-source" | isHyperlinkedSource]
871
870
, (\ (All b, xs) -> bool (map ((" --hide=" ++ ) . prettyShow) xs) [] b)
872
871
. argHideModules
873
872
$ args
874
873
, bool [" --ignore-all-exports" ] [] . getAny . argIgnoreExports $ args
875
- , maybe
876
- []
877
- ( \ (m, e, l) ->
878
- [ " --source-module=" ++ m
879
- , " --source-entity=" ++ e
880
- ]
881
- ++ if isVersion 2 14
882
- then [" --source-entity-line=" ++ l]
883
- else []
884
- )
885
- . flagToMaybe
886
- . argLinkSource
887
- $ args
874
+ , -- Haddock's --source-* options are ignored once --hyperlinked-source is
875
+ -- set.
876
+ -- See https://haskell-haddock.readthedocs.io/en/latest/invoking.html#cmdoption-hyperlinked-source
877
+ -- To avoid Haddock's warning, we only set --source-* options if
878
+ -- --hyperlinked-source is not set.
879
+ if isHyperlinkedSource
880
+ then []
881
+ else
882
+ maybe
883
+ []
884
+ ( \ (m, e, l) ->
885
+ [ " --source-module=" ++ m
886
+ , " --source-entity=" ++ e
887
+ ]
888
+ ++ if isVersion 2 14
889
+ then [" --source-entity-line=" ++ l]
890
+ else []
891
+ )
892
+ . flagToMaybe
893
+ . argLinkSource
894
+ $ args
888
895
, maybe [] ((: [] ) . (" --css=" ++ )) . flagToMaybe . argCssFile $ args
889
896
, maybe [] ((: [] ) . (" --use-contents=" ++ )) . flagToMaybe . argContents $ args
890
897
, bool [" --gen-contents" ] [] . fromFlagOrDefault False . argGenContents $ args
@@ -965,6 +972,10 @@ renderPureArgs version comp platform args =
965
972
| otherwise = " --verbose"
966
973
haddockSupportsVisibility = version >= mkVersion [2 , 26 , 1 ]
967
974
haddockSupportsPackageName = version > mkVersion [2 , 16 ]
975
+ haddockSupportsHyperlinkedSource = isVersion 2 17
976
+ isHyperlinkedSource =
977
+ haddockSupportsHyperlinkedSource
978
+ && fromFlagOrDefault False (argLinkedSource args)
968
979
969
980
---------------------------------------------------------------------------------
970
981
0 commit comments