diff --git a/src/merlin.ml b/src/merlin.ml index 5e2bbc62d1fe..a5d0cb233974 100644 --- a/src/merlin.ml +++ b/src/merlin.ml @@ -14,20 +14,19 @@ module Preprocess = struct | _, (Action _ as action) -> action | (Future_syntax _ as future_syntax), _ | _, (Future_syntax _ as future_syntax) -> future_syntax - | Pps { loc = _; pps = pps1; flags = flags1; staged = s1 }, + | Pps { loc ; pps = pps1; flags = flags1; staged = s1 }, Pps { loc = _; pps = pps2; flags = flags2; staged = s2 } -> - match - match Bool.compare s1 s2 with - | Gt| Lt as ne -> ne - | Eq -> - match List.compare flags1 flags2 ~compare:String.compare with - | Gt | Lt as ne -> ne - | Eq -> - List.compare pps1 pps2 ~compare:(fun (_, a) (_, b) -> - Lib_name.compare a b) - with - | Eq -> a - | _ -> No_preprocessing + if Bool.(<>) s1 s2 + || List.compare flags1 flags2 ~compare:String.compare <> Eq then + No_preprocessing + else + let pps = + let not_in_pps1 (_, pp) = + List.for_all pps1 ~f:(fun (_, pp') -> + Lib_name.compare pp' pp <> Eq) in + pps1 @ List.filter ~f:not_in_pps1 pps2 + in + Pps { loc ; pps; flags = flags1 ; staged = s1 } end let quote_for_merlin s = diff --git a/test/blackbox-tests/test-cases/github1946/run.t b/test/blackbox-tests/test-cases/github1946/run.t index 6a18e6deefcf..7477c110f256 100644 --- a/test/blackbox-tests/test-cases/github1946/run.t +++ b/test/blackbox-tests/test-cases/github1946/run.t @@ -1,2 +1,2 @@ $ dune build --display short --profile release | grep "FLG -ppx" - [1] + FLG -ppx '$TESTCASE_ROOT/_build/default/.ppx/4e93360991c22787c855ecab6b44c222/ppx.exe --as-ppx --cookie '\''library-name="usesppx1"'\'''