@@ -93,23 +93,23 @@ let oc_cmi buf namespace source =
9393 Ext_buffer. add_string buf Literals. suffix_cmi
9494
9595(* For cases with self cycle
96- e.g, in b.ml
97- {[
98- include B
99- ]}
100- When ns is not turned on, it makes sense that b may come from third party package.
101- Hoever, this case is wont supported.
102- It complicates when it has interface file or not.
103- - if it has interface file, the current interface will have priority, failed to build?
104- - if it does not have interface file, the build will not open this module at all(-bs-read-cmi)
96+ e.g, in b.ml
97+ {[
98+ include B
99+ ]}
100+ When ns is not turned on, it makes sense that b may come from third party package.
101+ Hoever, this case is wont supported.
102+ It complicates when it has interface file or not.
103+ - if it has interface file, the current interface will have priority, failed to build?
104+ - if it does not have interface file, the build will not open this module at all(-bs-read-cmi)
105105
106- When ns is turned on, `B` is interprted as `Ns-B` which is a cyclic dependency,
107- it can be errored out earlier
106+ When ns is turned on, `B` is interprted as `Ns-B` which is a cyclic dependency,
107+ it can be errored out earlier
108108
109- #5368: It turns out there are many false positives on detecting self-cycles (see: `jscomp/build_tests/zerocycle`)
110- To properly solve this, we would need to `jscomp/ml/depend.ml` because
111- cmi and cmj is broken in the first place (same problem as in ocaml/ocaml#4618).
112- So we will just ignore the self-cycles. Even if there is indeed a self-cycle, it should fail to compile anyway.
109+ #5368: It turns out there are many false positives on detecting self-cycles (see: `jscomp/build_tests/zerocycle`)
110+ To properly solve this, we would need to `jscomp/ml/depend.ml` because
111+ cmi and cmj is broken in the first place (same problem as in ocaml/ocaml#4618).
112+ So we will just ignore the self-cycles. Even if there is indeed a self-cycle, it should fail to compile anyway.
113113*)
114114let oc_deps (ast_file : string ) (is_dev : bool ) (db : Bsb_db_decode.t )
115115 (namespace : string option ) (buf : Ext_buffer.t ) (kind : [ `impl | `intf ] )
@@ -138,26 +138,26 @@ let oc_deps (ast_file : string) (is_dev : bool) (db : Bsb_db_decode.t)
138138 while ! offset < size do
139139 let next_tab = String. index_from s ! offset magic_sep_char in
140140 let dependent_module = String. sub s ! offset (next_tab - ! offset) in
141- if dependent_module = cur_module_name then
142- (* prerr_endline ("FAILED: " ^ cur_module_name ^ " has a self cycle");
143- exit 2*)
144- (* #5368 ignore self dependencies *) ()
141+ ( if dependent_module = cur_module_name then
142+ (* prerr_endline ("FAILED: " ^ cur_module_name ^ " has a self cycle");
143+ exit 2*)
144+ (* #5368 ignore self dependencies *) ()
145145 else
146- ( match Bsb_db_decode. find db dependent_module is_dev with
147- | None -> ()
148- | Some { dir_name; case } ->
149- Lazy. force at_most_once;
150- let source =
151- Filename. concat dir_name
152- (if case then dependent_module
153- else Ext_string. uncapitalize_ascii dependent_module)
154- in
155- Ext_buffer. add_char buf ' ' ;
156- if kind = `impl then (
157- output_file buf source namespace;
158- Ext_buffer. add_string buf Literals. suffix_cmj);
159- (* #3260 cmj changes does not imply cmi change anymore *)
160- oc_cmi buf namespace source);
146+ match Bsb_db_decode. find db dependent_module is_dev with
147+ | None -> ()
148+ | Some { dir_name; case } ->
149+ Lazy. force at_most_once;
150+ let source =
151+ Filename. concat dir_name
152+ (if case then dependent_module
153+ else Ext_string. uncapitalize_ascii dependent_module)
154+ in
155+ Ext_buffer. add_char buf ' ' ;
156+ if kind = `impl then (
157+ output_file buf source namespace;
158+ Ext_buffer. add_string buf Literals. suffix_cmj);
159+ (* #3260 cmj changes does not imply cmi change anymore *)
160+ oc_cmi buf namespace source);
161161 offset := next_tab + 1
162162 done ;
163163 if Lazy. is_val at_most_once then Ext_buffer. add_char buf '\n'
0 commit comments