Description
Describe the bug
Annotation are sometimes not attached to the correct statement in presence of javascript toplevel expression.
This result in the following behavior
diff --git a/runtime/stdlib.js b/runtime/stdlib.js
index 22d1c5101d..1205291dba 100644
--- a/runtime/stdlib.js
+++ b/runtime/stdlib.js
@@ -17,6 +17,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//Requires: caml_call_gen
+//Always
+globalThis.a = 2
+
+//Always
+globalThis.a = 3
+
//Provides: caml_call_gen (const, shallow)
//Weakdef
function caml_call_gen(f, args) {
$ make
dune build @all
File "compiler/tests-io/_unknown_", line 1, characters 0-0:
../../../install/default/bin/js_of_ocaml: Error: circular dependency: caml_call_gen, caml_js_wrap_callback_arguments