Skip to content

Commit 138080b

Browse files
committed
Fix infinite loop on annotations for SC2188 (fixes #1413)
1 parent 5b3f17c commit 138080b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/ShellCheck/Analytics.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,7 @@ checkRedirectedNowhere params token =
26922692
case drop 1 $ getPath (parentMap params) t of
26932693
T_DollarExpansion _ [_] : _ -> True
26942694
T_Backticked _ [_] : _ -> True
2695-
T_Annotation _ _ u : _ -> isInExpansion u
2695+
t@T_Annotation {} : _ -> isInExpansion t
26962696
_ -> False
26972697
getDanglingRedirect token =
26982698
case token of

src/ShellCheck/Checker.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,7 @@ prop_filewideAnnotation8 = null $
231231
prop_sourcePartOfOriginalScript = -- #1181: -x disabled posix warning for 'source'
232232
2039 `elem` checkWithIncludes [("./saywhat.sh", "echo foo")] "#!/bin/sh\nsource ./saywhat.sh"
233233

234+
prop_spinBug1413 = null $ check "fun() {\n# shellcheck disable=SC2188\n> /dev/null\n}\n"
235+
234236
return []
235237
runTests = $quickCheckAll

0 commit comments

Comments
 (0)