Support fgl 5.8.1.0.

ShellCheck used to rely on a bug in
Data.Graph.Inductive.Query.Dominators.dom where a node not reachable
from the root would be considered dominated by every node in the
graph.

This commit restores that functionality, and is therefore compatible
with both fgl 5.8.1.0 and previous versions.
This commit is contained in:
Troels Henriksen 2023-02-04 23:03:44 +01:00
commit d1bc22a737
2 changed files with 4 additions and 2 deletions

View file

@ -54,7 +54,7 @@ library
containers >= 0.5.6 && < 0.7, containers >= 0.5.6 && < 0.7,
deepseq >= 1.4.1 && < 1.5, deepseq >= 1.4.1 && < 1.5,
Diff >= 0.4.0 && < 0.5, Diff >= 0.4.0 && < 0.5,
fgl >= 5.7.0 && < 5.8.1.0, fgl >= 5.7.0 && < 5.9,
filepath >= 1.4.0 && < 1.5, filepath >= 1.4.0 && < 1.5,
mtl >= 2.2.2 && < 2.3, mtl >= 2.2.2 && < 2.3,
parsec >= 3.1.14 && < 3.2, parsec >= 3.1.14 && < 3.2,

View file

@ -1301,7 +1301,9 @@ findPostDominators mainexit graph = asArray
reversed = grev withExitEdges reversed = grev withExitEdges
postDoms = dom reversed mainexit postDoms = dom reversed mainexit
(_, maxNode) = nodeRange graph (_, maxNode) = nodeRange graph
asArray = array (0, maxNode) postDoms -- Assume everything *not* reachable from 'mainexit' has every
-- node as postdominator.
asArray = listArray (0, maxNode) (replicate (maxNode+1) (nodes graph)) // postDoms
return [] return []
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |]) runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])