Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -locations-check behaviour #506

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ details.
- Keep location ranges consistent when migrating `Pexp_function` nodes from 5.2+
to older versions (#504, @jchavarri)

- Fix `-locations-check` behaviour so it is no longer required to pass `-check`
as well to enable location checks. (#506, @NathanReb)


0.32.1 (2024-04-23)
-------------------
Expand Down
32 changes: 16 additions & 16 deletions src/driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ let map_structure_gen st ~tool_name ~hook ~expect_mismatch_handler ~input_name
let cookies_and_check st =
Cookies.call_post_handlers T;
let errors =
if !perform_checks then (
if !perform_checks then
(* TODO: these two passes could be merged, we now have more passes for
checks than for actual rewriting. *)
let unused_attributes_errors =
Expand All @@ -676,15 +676,15 @@ let map_structure_gen st ~tool_name ~hook ~expect_mismatch_handler ~input_name
else []
in
let not_seen_errors = Attribute.collect_unseen_errors () in
(if !perform_locations_check then
let open Location_check in
ignore
((enforce_invariants !loc_fname)#structure st
Non_intersecting_ranges.empty
: Non_intersecting_ranges.t));
unused_attributes_errors @ unused_extension_errors @ not_seen_errors)
unused_attributes_errors @ unused_extension_errors @ not_seen_errors
else []
in
(if !perform_locations_check then
let open Location_check in
ignore
((enforce_invariants !loc_fname)#structure st
Non_intersecting_ranges.empty
: Non_intersecting_ranges.t));
with_errors errors st
in
let file_path = get_default_path_str st in
Expand Down Expand Up @@ -740,7 +740,7 @@ let map_signature_gen sg ~tool_name ~hook ~expect_mismatch_handler ~input_name
let cookies_and_check sg =
Cookies.call_post_handlers T;
let errors =
if !perform_checks then (
if !perform_checks then
(* TODO: these two passes could be merged, we now have more passes for
checks than for actual rewriting. *)
let unused_attributes_errors =
Expand All @@ -752,15 +752,15 @@ let map_signature_gen sg ~tool_name ~hook ~expect_mismatch_handler ~input_name
else []
in
let not_seen_errors = Attribute.collect_unseen_errors () in
(if !perform_locations_check then
let open Location_check in
ignore
((enforce_invariants !loc_fname)#signature sg
Non_intersecting_ranges.empty
: Non_intersecting_ranges.t));
unused_attributes_errors @ unused_extension_errors @ not_seen_errors)
unused_attributes_errors @ unused_extension_errors @ not_seen_errors
else []
in
(if !perform_locations_check then
let open Location_check in
ignore
((enforce_invariants !loc_fname)#signature sg
Non_intersecting_ranges.empty
: Non_intersecting_ranges.t));
with_errors errors sg
in
let file_path = get_default_path_sig sg in
Expand Down
Loading