Skip to content

Conversation

@v-gb
Copy link
Contributor

@v-gb v-gb commented Oct 24, 2025

These locations, which are new in 5.4, are sometimes traversed (e.g. Pexp_setfield) and sometimes not (e.g. Pexp_field). So clearly a bug.

The fix is concretely:

  • change map_loc to map over both fields { loc; txt } of Location.loc
  • propagate the change, ie change map_loc to map_string_loc, map_string_opt_loc or map_loc_lid depending on the type. All occurrences of the latter are bug fixes.

Copy link
Collaborator

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot !

Can you merge main to make sure the crash in test-extra/code/ocaml/testsuite/tools/testRelocation.ml disappears ?

@Julow
Copy link
Collaborator

Julow commented Oct 27, 2025

This looks like it might fix bugs we haven't encountered yet. Can you write an entry in CHANGES.md in case we want to mention them later ?

These locations, which are new in 5.4, are sometimes traversed (e.g. Pexp_setfield) and
sometimes not (e.g. Pexp_field). So clearly a bug.

The fix is concretely:

- change map_loc to map over both fields `{ loc; txt }` of `Location.loc`
- propagate the change, ie change `map_loc` to `map_string_loc`,
  `map_string_opt_loc` or `map_loc_lid` depending on the type. All occurrences
  of the latter are bug fixes.
@v-gb v-gb force-pushed the push-wtoxqxoouqsm branch from f1a23a4 to f8b6a44 Compare October 27, 2025 11:37
@v-gb
Copy link
Contributor Author

v-gb commented Oct 27, 2025

Can you merge main to make sure the crash in test-extra/code/ocaml/testsuite/tools/testRelocation.ml disappears ?

What do you mean, concretely ?
I tried OCAMLFORMAT_EXE=$(readlink -f ../_build/default/bin/ocamlformat/main.exe) make DIRS=code/ocaml/testsuite/tools test_inplace before/after the change, and I see no difference. Also, the commands hides all the output, so it's not exactly convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants