diff --git a/compiler/frontend/bs_builtin_ppx.ml b/compiler/frontend/bs_builtin_ppx.ml index 8960731163..18d8c442d3 100644 --- a/compiler/frontend/bs_builtin_ppx.ml +++ b/compiler/frontend/bs_builtin_ppx.ml @@ -248,23 +248,21 @@ let expr_mapper ~async_context ~in_function_def (self : mapper) { Parsetree.pc_bar = None; pc_lhs = - Ast_helper.Pat.alias - (Ast_helper.Pat.construct ~loc {txt = Lident "None"; loc} None) - {txt = "x"; loc}; + Ast_helper.Pat.construct ~loc {txt = Lident "None"; loc} None; pc_guard = None; - pc_rhs = Ast_helper.Exp.ident ~loc {txt = Lident "x"; loc}; + pc_rhs = Ast_helper.Exp.construct ~loc {txt = Lident "None"; loc} None; } (* Option: continue on None, early-return on Some(x) *) | `Option_None -> { Parsetree.pc_bar = None; pc_lhs = - Ast_helper.Pat.alias - (Ast_helper.Pat.construct ~loc {txt = Lident "Some"; loc} - (Some (Ast_helper.Pat.any ~loc ()))) - {txt = "x"; loc}; + Ast_helper.Pat.construct ~loc {txt = Lident "Some"; loc} + (Some (Ast_helper.Pat.var ~loc {txt = "x"; loc})); pc_guard = None; - pc_rhs = Ast_helper.Exp.ident ~loc {txt = Lident "x"; loc}; + pc_rhs = + Ast_helper.Exp.construct ~loc {txt = Lident "Some"; loc} + (Some (Ast_helper.Exp.ident ~loc {txt = Lident "x"; loc})); } in default_expr_mapper self