From 45959f3b75fc212279dd924405fa5f88a598f403 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sun, 17 Nov 2024 14:37:54 -0800 Subject: [PATCH] fix(merlin): tolerate files without extension Signed-off-by: Antonio Nuno Monteiro --- src/dune_rules/merlin/merlin.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dune_rules/merlin/merlin.ml b/src/dune_rules/merlin/merlin.ml index 95ff0eb879f..df941fa690c 100644 --- a/src/dune_rules/merlin/merlin.ml +++ b/src/dune_rules/merlin/merlin.ml @@ -3,7 +3,12 @@ open Memo.O let remove_extension file = let dir = Path.Build.parent_exn file in - let basename, _ext = String.lsplit2_exn (Path.Build.basename file) ~on:'.' in + let basename = + let basename = Path.Build.basename file in + match String.lsplit2 basename ~on:'.' with + | Some (basename, _ext) -> basename + | None -> basename + in Path.Build.relative dir basename ;;