Skip to content

Commit b86e54d

Browse files
committed
Fix fatal error for external with @as
1 parent 6cfac38 commit b86e54d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

compiler/frontend/ast_external_process.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ let handle_attributes (loc : Bs_loc.t) (type_annotation : Parsetree.core_type)
10091009
check_return_wrapper loc external_desc.return_wrapper result_type
10101010
in
10111011
let fn_type = Ast_helper.Typ.arrows ~loc args result_type in
1012-
( build_uncurried_type ~arity:(List.length args) fn_type,
1012+
( fn_type,
10131013
External_ffi_types.ffi_bs arg_type_specs return_wrapper ffi,
10141014
unused_attrs,
10151015
relative )

tests/tests/src/AsInUncurriedExternals.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ function shouldNotFail(objectMode, name) {
1919
return 3;
2020
}
2121

22+
let constantValue = somescope.somefn({foo:true});
23+
2224
export {
2325
mo,
2426
options,
2527
shouldNotFail,
28+
constantValue,
2629
}
27-
/* No side effect */
30+
/* constantValue Not a pure module */

tests/tests/src/AsInUncurriedExternals.res

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ let mo = makeOptions
1313
let options = mo(~name="foo", ())
1414

1515
let shouldNotFail: (~objectMode: _, ~name: string) => int = (~objectMode, ~name) => 3
16+
17+
@scope("somescope")
18+
external constantArgOnly: @as(json`{foo:true}`) _ => string = "somefn"
19+
20+
let constantValue = constantArgOnly

0 commit comments

Comments
 (0)