Commit d23bc1af
d23bc1af84bdMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
fix(codegen): File.write unboxes poly path/data args
File.write(path, data) lowered to sp_file_write(path, data)
which takes const char *path, const char *data. With either arg
typed poly (cross-class union widened the producer's return slot
to sp_RbVal — the tep ParallelWorker case from #643), the bare
arg flowed through as struct, tripping "incompatible type for
argument" at C compile.
Mirror the existing :str FFI arg path (#502, #626 / 04f8929):
when an arg's static type is poly, extract .v.s before the call.
Closes #643.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- d23bc1af84bd
- Parent
- 2fd670948d89
spinel_codegen.rbmodifiedView file
@@ -29111,9 +29111,17 @@
2911129111
a1 = "0"2911229112
if arg_ids.length >= 12911329113
a0 = compile_expr(arg_ids[0])29114+
if infer_type(arg_ids[0]) == "poly"29115+
@needs_rb_value = 129116+
a0 = "(" + a0 + ").v.s"29117+
end2911429118
end2911529119
if arg_ids.length >= 22911629120
a1 = compile_expr(arg_ids[1])29121+
if infer_type(arg_ids[1]) == "poly"29122+
@needs_rb_value = 129123+
a1 = "(" + a1 + ").v.s"29124+
end2911729125
end2911829126
emit(" sp_file_write(" + a0 + ", " + a1 + ");")2911929127
return 1test/file_write_poly_arg.rbaddedView file
Loading diff…
test/file_write_poly_arg.rb.expectedaddedView file
Loading diff…