From d1bc22a7373e3ff73601157559a73409a06713d4 Mon Sep 17 00:00:00 2001 From: Troels Henriksen Date: Sat, 4 Feb 2023 23:03:44 +0100 Subject: [PATCH] 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. --- ShellCheck.cabal | 2 +- src/ShellCheck/CFG.hs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ShellCheck.cabal b/ShellCheck.cabal index 8afebe1..1226588 100644 --- a/ShellCheck.cabal +++ b/ShellCheck.cabal @@ -54,7 +54,7 @@ library containers >= 0.5.6 && < 0.7, deepseq >= 1.4.1 && < 1.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, mtl >= 2.2.2 && < 2.3, parsec >= 3.1.14 && < 3.2, diff --git a/src/ShellCheck/CFG.hs b/src/ShellCheck/CFG.hs index e0c6267..ebfeaa0 100644 --- a/src/ShellCheck/CFG.hs +++ b/src/ShellCheck/CFG.hs @@ -1301,7 +1301,9 @@ findPostDominators mainexit graph = asArray reversed = grev withExitEdges postDoms = dom reversed mainexit (_, 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 [] runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])