Replace !!! with pattern-matching where it's easy

This commit is contained in:
Joseph C. Sible 2023-12-31 15:55:06 -05:00
parent 6e5b5401c6
commit a786f996a1
3 changed files with 8 additions and 14 deletions

View file

@ -79,9 +79,8 @@ prop_checkForDecimals3 = verifyNot checkForDecimals "declare -A foo; foo[1.2]=ba
checkForDecimals = ForShell [Sh, Dash, BusyboxSh, Bash] f
where
f t@(TA_Expansion id _) = sequence_ $ do
str <- getLiteralString t
first <- str !!! 0
guard $ isDigit first && '.' `elem` str
first:rest <- getLiteralString t
guard $ isDigit first && '.' `elem` rest
return $ err id 2079 "(( )) doesn't support decimals. Use bc or awk."
f _ = return ()