From 493b6f9f489d4c976a9d11587b5bae90b0616e02 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Fri, 20 Dec 2024 21:52:28 -0800 Subject: [PATCH] cr: only enabled for Dune versions starting with 3.18 Signed-off-by: Antonio Nuno Monteiro --- src/dune_rules/preprocess.ml | 3 ++- .../blackbox-tests/test-cases/ppx/ppx-flags-plus.t | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/dune_rules/preprocess.ml b/src/dune_rules/preprocess.ml index b399384fbac..ae38e43e45e 100644 --- a/src/dune_rules/preprocess.ml +++ b/src/dune_rules/preprocess.ml @@ -16,7 +16,8 @@ module Pps_and_flags = struct ( String_with_vars.is_prefix ~prefix:"-" s , String_with_vars.is_prefix ~prefix:"+" s ) with - | Yes, _ | _, Yes -> Right s + | Yes, _ -> Right s + | _, Yes when syntax_version >= (3, 18) -> Right s | (No | Unknown _), _ -> let loc = String_with_vars.loc s in (match String_with_vars.text_only s with diff --git a/test/blackbox-tests/test-cases/ppx/ppx-flags-plus.t b/test/blackbox-tests/test-cases/ppx/ppx-flags-plus.t index 35d8257e028..c57e8425aee 100644 --- a/test/blackbox-tests/test-cases/ppx/ppx-flags-plus.t +++ b/test/blackbox-tests/test-cases/ppx/ppx-flags-plus.t @@ -33,3 +33,17 @@ Create ppx1 and exe: $ touch the_exe.ml $ dune build ./the_exe.exe + File "dune", line 9, characters 30-35: + 9 | (preprocess (pps ppx --alert ++foo))) + ^^^^^ + Error: Library "++foo" not found. + -> required by _build/default/.merlin-conf/exe-the_exe + -> required by _build/default/the_exe.exe + [1] + +Works since Dune 3.18 + + $ cat > dune-project < (lang dune 3.18) + > EOF + $ dune build ./the_exe.exe