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 >= 1
2911329113 a0 = compile_expr(arg_ids[0])
29114+ if infer_type(arg_ids[0]) == "poly"
29115+ @needs_rb_value = 1
29116+ a0 = "(" + a0 + ").v.s"
29117+ end
2911429118 end
2911529119 if arg_ids.length >= 2
2911629120 a1 = compile_expr(arg_ids[1])
29121+ if infer_type(arg_ids[1]) == "poly"
29122+ @needs_rb_value = 1
29123+ a1 = "(" + a1 + ").v.s"
29124+ end
2911729125 end
2911829126 emit(" sp_file_write(" + a0 + ", " + a1 + ");")
2911929127 return 1