Example code:
module type E = sig end
module A(E:E) = struct end [@@inline] (* No objects *)
module C(E:E) = struct class c = object end end [@@inline]
module O(E:E) = struct let o = object end end [@@inline]
Compiling with ocamlopt -c -w +53 test.ml gives the following output:
File "test.ml", line 3, characters 0-58:
3 | module C(E:E) = struct class c = object end end [@@inline]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 53 [misplaced-attribute]: the "inline" attribute cannot appear in this context
File "test.ml", line 4, characters 0-56:
4 | module O(E:E) = struct let o = object end end [@@inline]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 53 [misplaced-attribute]: the "inline" attribute cannot appear in this context
This shows that for the C and O functors, the [@@inline] attribute isn't correctly moved to the functor.
Initially reported by @talex5 at https://discuss.ocaml.org/t/capnproto-functor-inlining/12111/9
Example code:
Compiling with
ocamlopt -c -w +53 test.mlgives the following output:This shows that for the
CandOfunctors, the[@@inline]attribute isn't correctly moved to the functor.Initially reported by @talex5 at https://discuss.ocaml.org/t/capnproto-functor-inlining/12111/9