make •FFI properly error on non-list 𝕩

This commit is contained in:
dzaima 2024-12-04 00:11:43 +02:00
parent 162e6ff387
commit 86c7b47771
2 changed files with 3 additions and 0 deletions

View File

@ -1082,6 +1082,7 @@ static u64 calcStaticSize(B o) {
} }
B ffiload_c2(B t, B w, B x) { B ffiload_c2(B t, B w, B x) {
if (!isArr(x) || RNK(x)!=1) thrM("•FFI: 𝕩 must be a list");
usz xia = IA(x); usz xia = IA(x);
if (xia<2) thrM("FFI: Function specification must have at least two items"); if (xia<2) thrM("FFI: Function specification must have at least two items");
usz argn = xia-2; usz argn = xia-2;

View File

@ -5,6 +5,8 @@
# bad •FFI invocation # bad •FFI invocation
# generally weird # generally weird
!"•FFI: 𝕩 must be a list" % @•FFI @
!"•FFI: 𝕩 must be a list" % @•FFI 22<"a"
!"•FFI: Path must be a list of characters" % 12 •FFI """bqn_init" !"•FFI: Path must be a list of characters" % 12 •FFI """bqn_init"
!"This function can't be called monadically" % •FFI """bqn_init" !"This function can't be called monadically" % •FFI """bqn_init"
@ •FFI{𝕊: 28•CurrentError@} """bqn_this symbol doesn't exist" %% "FFI: Failed to find symbol: " @ •FFI{𝕊: 28•CurrentError@} """bqn_this symbol doesn't exist" %% "FFI: Failed to find symbol: "