Warn when $? refers to echo or condition (ref #2541)

This commit is contained in:
Vidar Holen 2022-07-23 09:38:58 -07:00
parent b261ec24f9
commit 5cf6e01ce9
4 changed files with 42 additions and 0 deletions

View file

@ -804,6 +804,7 @@ fulfillsDependency ctx entry dep =
-- it won't be found by the normal check.
DepIsRecursive node val | node == entry -> return True
DepIsRecursive node val -> return $ val == any (\f -> entryPoint f == node) (cStack ctx)
DepExitCodes val -> (== val) <$> peekStack (\s k -> sExitCodes s) S.empty ctx ()
-- _ -> error $ "Unknown dep " ++ show dep
where
peek scope = peekStack getVariableWithScope $ if scope == GlobalScope then (unknownVariableState, GlobalScope) else (unsetVariableState, LocalScope)