diff --git a/jscomp/frontend/bs_builtin_ppx.ml b/jscomp/frontend/bs_builtin_ppx.ml index 0e17ca23d3f..a2a8417a41e 100644 --- a/jscomp/frontend/bs_builtin_ppx.ml +++ b/jscomp/frontend/bs_builtin_ppx.ml @@ -601,7 +601,10 @@ let rec structure_mapper ~await_context (self : mapper) (stru : Ast_structure.t) {txt = safe_module_type_name; loc} ~typ:(Mty.typeof_ ~loc me))) :: aux expr) - | Pexp_fun (_, _, _, expr) -> aux expr + | Pexp_let (_, vbs, expr) -> aux expr @ spelunk_vbs acc vbs + | Pexp_ifthenelse (_, then_expr, Some else_expr) -> + aux then_expr @ aux else_expr + | Pexp_fun (_, _, _, expr) | Pexp_newtype (_, expr) -> aux expr | _ -> acc in aux pvb_expr @ spelunk_vbs acc tl diff --git a/jscomp/test/Import.js b/jscomp/test/Import.js index aac7b61eab8..4336162e616 100644 --- a/jscomp/test/Import.js +++ b/jscomp/test/Import.js @@ -114,6 +114,21 @@ async function f5(param) { ]; } +async function f6(param) { + var MS = await import("../../lib/js/belt_MapString.js"); + var A = await import("../../lib/js/belt_Array.js"); + return [ + 0, + MS.forEach, + A.forEach + ]; +} + +async function f7(param) { + await import("../../lib/js/belt_MapInt.js"); + return 1; +} + var each = M1.forEach; var M2; @@ -136,4 +151,6 @@ exports.f2 = f2; exports.f3 = f3; exports.f4 = f4; exports.f5 = f5; +exports.f6 = f6; +exports.f7 = f7; /* Not a pure module */