From 686eeddeced39bbe3b7314509d30477320e98fde Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 23 Sep 2024 02:26:56 +0900 Subject: [PATCH] bring back error reporting on unknown #prim --- jscomp/core/lam_convert.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jscomp/core/lam_convert.ml b/jscomp/core/lam_convert.ml index 7c18d140649..dfe624e90dc 100644 --- a/jscomp/core/lam_convert.ml +++ b/jscomp/core/lam_convert.ml @@ -387,7 +387,6 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) : (args : Lambda.lambda list) loc ~dynamic_import : Lam.t = let prim_name = a_prim.prim_name in match External_ffi_types.from_string a_prim.prim_native_name with - | Ffi_normal -> assert false | Ffi_obj_create labels -> let args = Ext_list.map args convert_aux in prim ~primitive:(Pjs_object_create labels) ~args loc @@ -400,6 +399,10 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) : let args = Ext_list.map args convert_aux in Lam.handle_bs_non_obj_ffi arg_types result_type ffi args loc prim_name ~dynamic_import | Ffi_inline_const i -> Lam.const i + | Ffi_normal -> Location.raise_errorf ~loc + "@{Error:@} internal error, using unrecognized \ + primitive %s" + prim_name and convert_aux ?(dynamic_import = false) (lam : Lambda.lambda) : Lam.t = match lam with