Skip to content

Conversation

@fantazio
Copy link
Collaborator

There was a mistake in the expected outputs of scenario threshold-3-0.5 : 2 files (examples/using_make/matchopt.ml and examples/using_make/dir/matchopt.ml) are identical so their expected reports should also be identical.
This PR fixes the .exp file and the analyzer.

The commits are already pretty descriptive.
I plan to merge it before updating the version to 1.0.1

@fantazio fantazio mentioned this pull request Dec 15, 2025
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.
@fantazio fantazio force-pushed the fix_filename_collision branch from 541e9f1 to 676c392 Compare December 16, 2025 15:58
@fantazio fantazio merged commit e689746 into LexiFi:master Dec 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant