Fix infinite loop on annotations for SC2188 (fixes #1413)

This commit is contained in:
Vidar Holen 2018-12-16 14:42:19 -08:00
parent 5b3f17c29d
commit 138080bdc7
2 changed files with 3 additions and 1 deletions

View File

@ -2692,7 +2692,7 @@ checkRedirectedNowhere params token =
case drop 1 $ getPath (parentMap params) t of case drop 1 $ getPath (parentMap params) t of
T_DollarExpansion _ [_] : _ -> True T_DollarExpansion _ [_] : _ -> True
T_Backticked _ [_] : _ -> True T_Backticked _ [_] : _ -> True
T_Annotation _ _ u : _ -> isInExpansion u t@T_Annotation {} : _ -> isInExpansion t
_ -> False _ -> False
getDanglingRedirect token = getDanglingRedirect token =
case token of case token of

View File

@ -231,5 +231,7 @@ prop_filewideAnnotation8 = null $
prop_sourcePartOfOriginalScript = -- #1181: -x disabled posix warning for 'source' prop_sourcePartOfOriginalScript = -- #1181: -x disabled posix warning for 'source'
2039 `elem` checkWithIncludes [("./saywhat.sh", "echo foo")] "#!/bin/sh\nsource ./saywhat.sh" 2039 `elem` checkWithIncludes [("./saywhat.sh", "echo foo")] "#!/bin/sh\nsource ./saywhat.sh"
prop_spinBug1413 = null $ check "fun() {\n# shellcheck disable=SC2188\n> /dev/null\n}\n"
return [] return []
runTests = $quickCheckAll runTests = $quickCheckAll