[sledge] Fix assert when Fpath.v passed empty string

Summary:
It is possible for the filename of a source location to be the empty
string. Fpath.v asserts when passed an empty string.

Reviewed By: jvillard

Differential Revision: D27188304

fbshipit-source-id: a7d73444b
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent d65df3457f
commit e32f5ef6bd

@ -20,7 +20,10 @@ let root = ref None
let pp fs ({dir; file; line; col} as loc) =
if not (equal loc none) then Format.pp_print_string fs "; " ;
( if not (String.is_empty dir) then
let dir_file = Fpath.append (Fpath.v dir) (Fpath.v file) in
let dir_file =
if String.is_empty file then Fpath.v dir
else Fpath.append (Fpath.v dir) (Fpath.v file)
in
let relative =
let* root = !root in
let+ relative = Fpath.relativize ~root:(Fpath.v root) dir_file in

Loading…
Cancel
Save