File tree 4 files changed +27
-3
lines changed
build_tests/zerocycle/src
4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,11 @@ let oc_cmi buf namespace source =
105
105
106
106
When ns is turned on, `B` is interprted as `Ns-B` which is a cyclic dependency,
107
107
it can be errored out earlier
108
+
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.
108
113
*)
109
114
let oc_deps (ast_file : string ) (is_dev : bool ) (db : Bsb_db_decode.t )
110
115
(namespace : string option ) (buf : Ext_buffer.t ) (kind : [ `impl | `intf ] )
@@ -133,9 +138,11 @@ let oc_deps (ast_file : string) (is_dev : bool) (db : Bsb_db_decode.t)
133
138
while ! offset < size do
134
139
let next_tab = String. index_from s ! offset magic_sep_char in
135
140
let dependent_module = String. sub s ! offset (next_tab - ! offset) in
136
- if dependent_module = cur_module_name then (
137
- prerr_endline (" FAILED: " ^ cur_module_name ^ " has a self cycle" );
138
- exit 2 );
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 *) ()
145
+ else
139
146
(match Bsb_db_decode. find db dependent_module is_dev with
140
147
| None -> ()
141
148
| Some { dir_name; case } ->
Original file line number Diff line number Diff line change
1
+ // one-file false positive
2
+
3
+ module Nested = {
4
+ module Bar = {
5
+ type t = private int
6
+ }
7
+ }
8
+
9
+ open Nested
10
+
11
+ module Bar = {
12
+ open Bar
13
+ let t : t = Obj .magic (42 )
14
+ }
Original file line number Diff line number Diff line change
1
+ module Foo2 = {}
Original file line number Diff line number Diff line change
1
+ open Demo2
2
+ include Foo2
You can’t perform that action at this time.
0 commit comments