Drop a shadowed testdir
local to then
body
#342
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In 8949ef3 (Improve log for failed checks with no diff files, 2023-11-06), in
checkdiff(config)
, I mistakenly shadowedtestdir
inside athen
body (if ... then <then body> end
). This makes the assignments to thattestdir
local tothen
body, hence its new value is not used by statements afterif
block (see https://www.lua.org/pil/4.2.html).Wrong way
Right way
Recently this problem was found and fixed in 761a672 (Print failures correctly when these occur in multiple configs, 2024-01-04) and 29a6933 (Exclude "build" as a config, 2024-01-08). But the fixes leave two copies of similar logic in
checkdiff(config)
, see lines 1060-1063 and 1068-1071.This PR removes the second copy, the one inside
then
body. I decided to leave the assignment to localtestdir
at the top of function body, rather than inside nestedif
blocks, to make the function's main logic a little easier to understand.l3build/l3build-check.lua
Lines 1059 to 1072 in 0d59291