Don't warn about empty assignments when at end of command.
This commit is contained in:
parent
f77821625c
commit
d01b59a827
|
@ -2071,6 +2071,8 @@ prop_readAssignmentWord7 = isOk readAssignmentWord "a[3$n'']=42"
|
|||
prop_readAssignmentWord8 = isOk readAssignmentWord "a[4''$(cat foo)]=42"
|
||||
prop_readAssignmentWord9 = isOk readAssignmentWord "IFS= "
|
||||
prop_readAssignmentWord9a= isOk readAssignmentWord "foo="
|
||||
prop_readAssignmentWord9b= isOk readAssignmentWord "foo= "
|
||||
prop_readAssignmentWord9c= isOk readAssignmentWord "foo= #bar"
|
||||
prop_readAssignmentWord10= isWarning readAssignmentWord "foo$n=42"
|
||||
prop_readAssignmentWord11= isOk readAssignmentWord "foo=([a]=b [c] [d]= [e f )"
|
||||
prop_readAssignmentWord12= isOk readAssignmentWord "a[b <<= 3 + c]='thing'"
|
||||
|
@ -2089,7 +2091,7 @@ readAssignmentWord = try $ do
|
|||
isEndOfCommand <- liftM isJust $ optionMaybe (try . lookAhead $ (disregard (oneOf "\r\n;&|)") <|> eof))
|
||||
if not hasLeftSpace && (hasRightSpace || isEndOfCommand)
|
||||
then do
|
||||
when (variable /= "IFS" && hasRightSpace) $
|
||||
when (variable /= "IFS" && hasRightSpace && not isEndOfCommand) $
|
||||
parseNoteAt pos WarningC 1007
|
||||
"Remove space after = if trying to assign a value (for empty string, use var='' ... )."
|
||||
value <- readEmptyLiteral
|
||||
|
|
Loading…
Reference in New Issue