Skip to content

Commit 32e6291

Browse files
committed
fix resi
1 parent 88eb6f6 commit 32e6291

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

compiler/ml/cmt_format.ml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,15 @@ let get_saved_types () = !saved_types
167167
let set_saved_types l = saved_types := l
168168

169169
let record_deprecated_used ?deprecated_context ?migration_template ?migration_in_pipe_chain_template source_loc deprecated_text =
170-
deprecated_used := {Cmt_utils.source_loc; deprecated_text; migration_template; migration_in_pipe_chain_template; context = deprecated_context} :: !deprecated_used
170+
deprecated_used :=
171+
{
172+
Cmt_utils.source_loc;
173+
deprecated_text;
174+
migration_template;
175+
migration_in_pipe_chain_template;
176+
context = deprecated_context;
177+
}
178+
:: !deprecated_used
171179

172180
let _ = Cmt_utils.record_deprecated_used := record_deprecated_used
173181

@@ -210,4 +218,4 @@ let save_cmt filename modname binary_annots sourcefile initial_env cmi =
210218
output_cmt oc cmt)
211219
end;
212220
clear ()
213-
#endif
221+
#endif
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* Migration tests for interface (.resi) files using stdlib deprecations */
22

33
// Type alias migrations exercised via externals
4-
external arr: JSON.t<int> = "arr"
5-
external reT: Js.Re.t = "re"
6-
external json: Js.Json.t = "json"
7-
external nestedArr: Js.Array.t<Js.Re.t> = "nestedArr"
4+
external arr: array<int> = "arr"
5+
external reT: RegExp.t = "re"
6+
external json: JSON.t = "json"
7+
external nestedArr: array<RegExp.t> = "nestedArr"
88

99
// Function type using a deprecated alias
10-
external useSet: Js.Set.t<int> => unit = "useSet"
10+
external useSet: Set.t<int> => unit = "useSet"
1111

tools/src/migrate.ml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -703,19 +703,8 @@ let migrate ~entryPointFile ~outputMode =
703703
let {Res_driver.parsetree = signature; comments; source} =
704704
parser ~filename:path
705705
in
706-
(* Load cmti/cmt info to obtain deprecation migration templates, just like .res *)
707-
match
708-
(* Prefer implementation cmt info when available, since cmti may not
709-
record deprecated usages. Fallback to cmti if needed. *)
710-
let impl_path =
711-
if Filename.check_suffix path ".resi" then
712-
Filename.chop_suffix path ".resi" ^ ".res"
713-
else path
714-
in
715-
match Cmt.loadCmtInfosFromPath ~path:impl_path with
716-
| Some infos -> Some infos
717-
| None -> Cmt.loadCmtInfosFromPath ~path
718-
with
706+
707+
match Cmt.loadCmtInfosFromPath ~path with
719708
| None ->
720709
Error
721710
(Printf.sprintf

0 commit comments

Comments
 (0)