feat(runtime): add torb_file_read_all_text for IoError.path as a Path #681
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/680-ioerror-path"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Teaching half of step 3 of the
Pathmigration (docs/design/PATH.md slice 2), #680.IoError.pathcannot become aPathin one go:File.readAllhas nopathparameter, so the runtime writes that field of theIoErrorthrough atorb_text *out parameter, and the lowering would hand it aPath *. The published seed4b3045d31334cannot compile that (torb_file_read_allrejectsPath *wheretorb_text *is expected; I hit exactly this with the full migration locally).This PR adds only what the migration needs the seed to know:
torb_file_read_all_text(torb_file *file, ...)inruntime/file.c/torb.h;torb_file_read_allnow calls it, behaviour unchanged.fileReadAllText(compiler/src/backend/c/natives.trb),torb_natives.h,machine_natives.c(thunk 91, later ones shifted),docs/design/NATIVES.mdrow and counts (keep 204, total 548).runtime/tests/file_test.cfor the closed-file failure path of the new function.Nothing in
std/uses the new native yet. Part of #68.Test evidence
torb check compiler: 416 files, no problems (nightly).torb test compiler/tests/natives-audit.test.trb: 11 passed (the audit table and counts).tools/check-commits.sh origin/main HEAD: clean.sh tools/gates.sh arun in forge CI only.machine_natives.cwas edited by hand because the nightly'storb nativeswrites its own manifest, not this branch's.Seed statement
A seed must be published from main after this merges (Actions →
seed→ Run workflow). Only then can the migration commitrefactor(fs): IoError.path is a Path(IoError.path: Path,File.readAllas a TorbScript wrapper overfileReadAllTextwith a privateReadFailure { path: String, message: String }, allstd/fs,std/io,std/process,compiler/sites, tests, docs) be pushed. It is ready and checked locally (torb checkclean,std/fstests 41/41), kept off this PR on purpose.Into<Path>signatures (PATH slice 2) #68Approved. Checklist:
runtime/tests/file_test.c. CI is green on this head, including gates, tier A/B, bootstrap (linux-x64), same-C-on-every-host and pdisc.torb_file_read_allnow delegates totorb_file_read_all_textwith identical behaviour. Themachine_natives.cthunk 91 is inserted in manifest order, later thunks are shifted by one, and the native count is 333.std/uses the native yet.NATIVES.mdrow and counts (keep 204, total 548) match the manifest.After merge: the PR body names a seed publish from main, then the follow-up migration commit. That is the author's step.
IoError.pathbecomes aPath(step 3 of #68) #680Into<Path>signatures (PATH slice 2) #68IoError.pathbecomes aPath(step 3 of #68) #680