From 208e38358e8c07688a29867235971136a8ed0092 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Tue, 19 Dec 2023 01:00:20 -0500 Subject: [PATCH] Use a list comprehension to remove partiality from notesForContext --- src/ShellCheck/Parser.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 115de6470..04bdbc48b 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -3507,13 +3507,11 @@ parseShell env name contents = do -- A final pass for ignoring parse errors after failed parsing isIgnored stack note = any (contextItemDisablesCode False (codeForParseNote note)) stack -notesForContext list = zipWith ($) [first, second] $ filter isName list +notesForContext list = zipWith ($) [first, second] [(pos, str) | ContextName pos str <- list] where - isName (ContextName _ _) = True - isName _ = False - first (ContextName pos str) = ParseNote pos pos ErrorC 1073 $ + first (pos, str) = ParseNote pos pos ErrorC 1073 $ "Couldn't parse this " ++ str ++ ". Fix to allow more checks." - second (ContextName pos str) = ParseNote pos pos InfoC 1009 $ + second (pos, str) = ParseNote pos pos InfoC 1009 $ "The mentioned syntax error was in this " ++ str ++ "." -- Go over all T_UnparsedIndex and reparse them as either arithmetic or text