Skip to content

Comments

Preserve flags ordering in Merlin configuration files.#11503

Merged
Leonidas-from-XIV merged 5 commits intoocaml:mainfrom
voodoos:fix-merlin-flags-ordering
Feb 28, 2025
Merged

Preserve flags ordering in Merlin configuration files.#11503
Leonidas-from-XIV merged 5 commits intoocaml:mainfrom
voodoos:fix-merlin-flags-ordering

Conversation

@voodoos
Copy link
Collaborator

@voodoos voodoos commented Feb 25, 2025

Dune generated open flags for wrappers are passed last to the compiler, but they are preceding the user-defined flags in the generated Merlin configuration. This means that opens are not applied in the same order by the compiler and Merlin, leading to inconsistencies such as the one described in ocaml/merlin#1900

This PR restores the correct order.

Fixes ocaml/merlin#1900

Copy link
Collaborator

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Choose a reason for hiding this comment

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

Thanks, looks like a very useful fix to have. Can you please add a changelog entry as well?

@voodoos voodoos force-pushed the fix-merlin-flags-ordering branch from 9703f75 to 956c989 Compare February 27, 2025 12:38
voodoos added a commit to voodoos/dune that referenced this pull request Feb 27, 2025
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
@voodoos voodoos force-pushed the fix-merlin-flags-ordering branch from 956c989 to a1fad9e Compare February 27, 2025 16:10
voodoos added a commit to voodoos/dune that referenced this pull request Feb 27, 2025
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
@voodoos voodoos force-pushed the fix-merlin-flags-ordering branch from a1fad9e to 5375862 Compare February 27, 2025 16:15
Copy link
Collaborator

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Choose a reason for hiding this comment

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

Yeah, this is a very nice solution. Thanks for the contribution!

Fixes ocaml/merlin#1900

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
@Leonidas-from-XIV Leonidas-from-XIV force-pushed the fix-merlin-flags-ordering branch from 5375862 to 4988951 Compare February 28, 2025 15:01
@Leonidas-from-XIV Leonidas-from-XIV merged commit d9c52fc into ocaml:main Feb 28, 2025
24 of 25 checks passed
Leonidas-from-XIV pushed a commit to Leonidas-from-XIV/dune that referenced this pull request Mar 6, 2025
* Preserve flags ordering in Merlin configuration files.

Fixes ocaml/merlin#1900

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Promote expected changes in the testsuite

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Make flag treatment clearer

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Add changelog entry for ocaml#11503

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Use dedicated filter opt function

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

---------

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
maiste added a commit to maiste/opam-repository that referenced this pull request Mar 31, 2025
CHANGES:

### Fixed

- Support HaikuOS: don't call `execve` since it's not allowed if other pthreads
  have been created. The fact that Haiku can't call `execve` from other threads
  than the principal thread of a process (a team in haiku jargon), is a
  discrepancy to POSIX and hence there is a [bug about
  it](https://dev.haiku-os.org/ticket/18665). (@Sylvain78, ocaml/dune#10953)
- Fix flag ordering in generated Merlin configurations (ocaml/dune#11503, @voodoos, fixes
  ocaml/merlin#1900, reported by @vouillon)

### Added

- Add `(format-dune-file <src> <dst>)` action. It provides a replacement to
  `dune format-dune-file` command.  (ocaml/dune#11166, @nojb)
- Allow the `--prefix` flag when configuring dune with `ocaml configure.ml`.
  This allows to set the prefix just like `$ dune install --prefix`. (ocaml/dune#11172,
  @rgrinberg)
- Allow arguments starting with `+` in preprocessing definitions (starting with
  `(lang dune 3.18)`). (@amonteiro, ocaml/dune#11234)
- Support for opam `(maintenance_intent ...)` in dune-project (ocaml/dune#11274, @art-w)
- Validate opam `maintenance_intent` (ocaml/dune#11308, @art-w)
- Support `not` in package dependencies constraints (ocaml/dune#11404, @art-w, reported
  by @hannesm)

### Changed

- Warn when failing to discover root due to reads failing. The previous
  behavior was to abort. (@KoviRobi, ocaml/dune#11173)
- Use shorter path for inline-tests artifacts. (@hhugo, ocaml/dune#11307)
- Allow dash in `dune init` project name (ocaml/dune#11402, @art-w, reported by @saroupille)
- On Windows, under heavy load, file delete operations can sometimes fail due to
  AV programs, etc. Guard against it by retrying the operation up to 30x with a
  1s waiting gap (ocaml/dune#11437, fixes ocaml/dune#11425, @MSoegtropIMC)
- Cache: we now only store the executable permission bit for files (ocaml/dune#11541,
  fixes ocaml/dune#11533, @ElectreAAS)
- Display negative error codes on Windows in hex which is the more customary
  way to display `NTSTATUS` codes (ocaml/dune#11504, @MisterDA)
maiste added a commit to maiste/opam-repository that referenced this pull request Apr 3, 2025
CHANGES:

### Fixed

- Support HaikuOS: don't call `execve` since it's not allowed if other pthreads
  have been created. The fact that Haiku can't call `execve` from other threads
  than the principal thread of a process (a team in haiku jargon), is a
  discrepancy to POSIX and hence there is a [bug about
  it](https://dev.haiku-os.org/ticket/18665). (@Sylvain78, ocaml/dune#10953)
- Fix flag ordering in generated Merlin configurations (ocaml/dune#11503, @voodoos, fixes
  ocaml/merlin#1900, reported by @vouillon)

### Added

- Add `(format-dune-file <src> <dst>)` action. It provides a replacement to
  `dune format-dune-file` command.  (ocaml/dune#11166, @nojb)
- Allow the `--prefix` flag when configuring dune with `ocaml configure.ml`.
  This allows to set the prefix just like `$ dune install --prefix`. (ocaml/dune#11172,
  @rgrinberg)
- Allow arguments starting with `+` in preprocessing definitions (starting with
  `(lang dune 3.18)`). (@amonteiro, ocaml/dune#11234)
- Support for opam `(maintenance_intent ...)` in dune-project (ocaml/dune#11274, @art-w)
- Validate opam `maintenance_intent` (ocaml/dune#11308, @art-w)
- Support `not` in package dependencies constraints (ocaml/dune#11404, @art-w, reported
  by @hannesm)

### Changed

- Warn when failing to discover root due to reads failing. The previous
  behavior was to abort. (@KoviRobi, ocaml/dune#11173)
- Use shorter path for inline-tests artifacts. (@hhugo, ocaml/dune#11307)
- Allow dash in `dune init` project name (ocaml/dune#11402, @art-w, reported by @saroupille)
- On Windows, under heavy load, file delete operations can sometimes fail due to
  AV programs, etc. Guard against it by retrying the operation up to 30x with a
  1s waiting gap (ocaml/dune#11437, fixes ocaml/dune#11425, @MSoegtropIMC)
- Cache: we now only store the executable permission bit for files (ocaml/dune#11541,
  fixes ocaml/dune#11533, @ElectreAAS)
- Display negative error codes on Windows in hex which is the more customary
  way to display `NTSTATUS` codes (ocaml/dune#11504, @MisterDA)
anmonteiro pushed a commit to anmonteiro/dune that referenced this pull request Apr 22, 2025
* Preserve flags ordering in Merlin configuration files.

Fixes ocaml/merlin#1900

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Promote expected changes in the testsuite

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Make flag treatment clearer

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Add changelog entry for ocaml#11503

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Use dedicated filter opt function

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

---------

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Sudha247 pushed a commit to Sudha247/dune that referenced this pull request Jul 23, 2025
* Preserve flags ordering in Merlin configuration files.

Fixes ocaml/merlin#1900

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Promote expected changes in the testsuite

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Make flag treatment clearer

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Add changelog entry for ocaml#11503

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

* Use dedicated filter opt function

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>

---------

Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modules opened in the wrong order?

2 participants