|
| 1 | +Since we generate invalid syntax for the argument of the make fn `(Props : <>)` |
| 2 | +We need to output ML syntax here, otherwise refmt could not parse it. |
| 3 | + $ ../ppx.sh --output ml input.re |
| 4 | + module X_as_main_function = |
| 5 | + struct |
| 6 | + external xProps : ?key:string -> unit -> < > Js.t = ""[@@mel.obj ] |
| 7 | + let x () = ReactDOM.jsx "div" (((ReactDOM.domProps)[@merlin.hide ]) ()) |
| 8 | + let x = |
| 9 | + let Output$X_as_main_function$x (Props : < > Js.t) = x () in |
| 10 | + Output$X_as_main_function$x |
| 11 | + end |
| 12 | + module Create_element_as_main_function = |
| 13 | + struct |
| 14 | + external createElementProps : |
| 15 | + lola:'lola -> ?key:string -> unit -> < lola: 'lola > Js.t = "" |
| 16 | + [@@mel.obj ] |
| 17 | + let createElement = |
| 18 | + ((fun ~lola -> |
| 19 | + ReactDOM.jsx "div" |
| 20 | + (((ReactDOM.domProps)[@merlin.hide ]) |
| 21 | + ~children:(React.string lola) ())) |
| 22 | + [@warning "-16"]) |
| 23 | + let createElement = |
| 24 | + let Output$Create_element_as_main_function$createElement |
| 25 | + (Props : < lola: 'lola > Js.t) = |
| 26 | + createElement ~lola:(Props ## lola) in |
| 27 | + Output$Create_element_as_main_function$createElement |
| 28 | + end |
| 29 | + module Invalid_case = |
| 30 | + struct |
| 31 | + external makeProps : |
| 32 | + lola:'lola -> ?key:string -> unit -> < lola: 'lola > Js.t = "" |
| 33 | + [@@mel.obj ] |
| 34 | + let make = |
| 35 | + ((fun ~lola -> |
| 36 | + React.jsx Create_element_as_main_function.make |
| 37 | + (Create_element_as_main_function.makeProps ~lola ())) |
| 38 | + [@warning "-16"]) |
| 39 | + let make = |
| 40 | + let Output$Invalid_case (Props : < lola: 'lola > Js.t) = |
| 41 | + make ~lola:(Props ## lola) in |
| 42 | + Output$Invalid_case |
| 43 | + end |
| 44 | + module Valid_case = |
| 45 | + struct |
| 46 | + external makeProps : ?key:string -> unit -> < > Js.t = ""[@@mel.obj ] |
| 47 | + let make () = |
| 48 | + React.jsx Component_with_x_as_main_function.x |
| 49 | + (Component_with_x_as_main_function.xProps ()) |
| 50 | + let make = |
| 51 | + let Output$Valid_case (Props : < > Js.t) = make () in |
| 52 | + Output$Valid_case |
| 53 | + end |
0 commit comments