Fix robustness against location collisions for opt args reports#37
Merged
fantazio merged 3 commits intoLexiFi:masterfrom Dec 21, 2025
Merged
Fix robustness against location collisions for opt args reports#37fantazio merged 3 commits intoLexiFi:masterfrom
fantazio merged 3 commits intoLexiFi:masterfrom
Conversation
In `threshold-3-0.5.exp`, there was only expected results for `examples/matchopt.ml` and not for `examples/dir/matchopt.ml` in the "optional arguments always/never used except once" sections. Because these files are copies of each other and self-sustaining, the expected results for both should be the same. Running on them separately confirms the new expected results.
If two files are copies of each other, then their internal locations are equal. In the case of optional arguments, these locations (and labels, which are also identical in both files) were used as keys in a table. Thus, optioanl arguments uses from both files were merged and then reduced by a `sort_uniq` as if there was only one file to begin with. Consequently, only one of the 2 files would actually see its optional arguments always/never used reported. Adding the builddir in the table's key fixes this issue (2 files with the same name cannot exist withing a unique builddir). The update of `threshold-3-0.5.ref` show that the missing reports are now appearing but in the wrong order.
When reporting on optional arguments, the different values are sorted by `abspath` and locations first. When 2 files have the same filename (found in locations), their `abspath` would be identical too because it only provides the path of the latest of the 2 files met. Thus, they were reported together although they belong to different directories. Using the available builddirs to reconstruct the filepaths instead of abspath is less error-prone and fixes the ordering issue. Howver, it incurs the cost of the new strings.
541e9f1 to
676c392
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There was a mistake in the expected outputs of scenario
threshold-3-0.5: 2 files (examples/using_make/matchopt.mlandexamples/using_make/dir/matchopt.ml) are identical so their expected reports should also be identical.This PR fixes the
.expfile and the analyzer.The commits are already pretty descriptive.
I plan to merge it before updating the version to 1.0.1