From 61c1eea2db27f6504c2076c3717dfdac01b93d71 Mon Sep 17 00:00:00 2001 From: David Pichardie Date: Thu, 21 Nov 2024 07:32:19 -0800 Subject: [PATCH] [inferpython] fix sourcefile name Summary: The sourcefile name was of the form "dir1::dir2::file.py". It is now "dir1/dir2/file.py". The "::" are used when creating Textual class names where "." is reserved. Reviewed By: martintrojer Differential Revision: D66297797 fbshipit-source-id: d7da558bf456d6f9531dd0e9bf2e5f53f1c072d1 --- infer/src/python/PyIR2Textual.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/infer/src/python/PyIR2Textual.ml b/infer/src/python/PyIR2Textual.ml index d75508f9ec..b9d456a9d8 100644 --- a/infer/src/python/PyIR2Textual.ml +++ b/infer/src/python/PyIR2Textual.ml @@ -501,7 +501,9 @@ let mk_procdesc proc_kind let mk_module {Module.name; toplevel; functions} = - let filename = F.asprintf "%a.py" Ident.pp name (* TODO: may not work with nested paths *) in + let filename = + F.asprintf "%a.py" Ident.pp name |> String.substr_replace_all ~pattern:"::" ~with_:"/" + in let sourcefile = Textual.SourceFile.create filename in let decls = List.map (QualName.Map.bindings functions) ~f:(fun (qual_name, cfg) ->