Repository navigation
:install-user installs through the .Install kind's placement: temp + rename + verified launch - #1371
Conversation
a7e2004 to
06cb0b8
Compare
6c7f036 to
45f8aa4
Compare
|
Batch battery (seed-driven) on main dd786a4 + #1355 → #1357 → #1370 → #1371 as one linear chain (head 45f8aa4): build ok, :fixpoint ok, :test ok (no reds), :test-green ok, :last-green ok. The four PRs are now stacked exactly as tested (each branch = its commit on top of the previous PR); merge in order #1355, #1357, #1370, #1371, retargeting each to main as its parent merges. |
45f8aa4 to
5f550b3
Compare
|
Battery (seed-driven) on main 00408eb + #1400 → #1370 → #1371 → #1397 as one chain (head 37a2441): build ok, :fixpoint ok, :test ok (no reds), :test-green ok, :last-green ok. Each branch holds exactly its tested commit on top of the previous PR's; all target main. Merge in order #1400, #1370, #1371, #1397. |
…orms (#1346) parse_trait_decl and parse_impl_block treated ':' as optional punctuation, skipped newlines, and collected members until one started at column 0, so an inline first member followed by indented members was one body, and a bodyless `impl Foo for X` (§2.3) swallowed the indented `fn` lines after it. Both now name the body form once (parse_decl_body_introducer) and read member boundaries from it (decl_member_continues): - Form 1 (':' then content): one member; a second is reported ("an inline trait body is a single member ...", fix-it: end the line after the header and indent the first member). Newlines inside the member's parentheses stay part of it. - Form 2 (':' ends the line): members indented deeper than the header line; nothing indented below is "expected an indented trait body after ':'", as for `fn f:`. - Form 3 (braces): members separated by newlines or semicolons (semicolons were rejected before). - impl/extend with no introducer is bodyless and ends at its newline; indented lines after it are reported with the fix-it `impl Foo for X:`. Any other token after an impl header is "expected ':' or '{' after the impl header" (it used to fall through silently). Sweep: every .w under src lib rt tools test examples build build.w parsed with the installed compiler and this stage1; no file changes verdict except the new fixtures and files that use syntax newer than the installed compiler. (cherry picked from commit 7aff486) (cherry picked from commit 225ea6ed80a74de2a10e312b4fc7e91d61cde028)
…checks (§9.7, §30.4) (#1354) Root cause: Parser.parse_let_binding computed is_mut for `var`, then built every pattern let (tuple/struct/slice via parse_let_pattern_rest, and the `.V(..)`/`V(..)` let-else forms) as NK_LET_ELSE(pattern, value, else) with no slot for it. SemaCheck.check_pattern then bound every name with scope_put(sym, ty, 0), so `var (x, y) = f()` then `x = ...` failed with "cannot assign to immutable variable". The same missing slot made `let (a, b): (i64, i64) = ...` a parse error, though LET_STMT allows it. - Ast: a pattern let's NK_LET_ELSE.d0 is now an NK_LET_PATTERN head (pattern, bit0 = var, type annotation), read through let_pattern / let_pattern_is_mut / let_pattern_type_ann. - Parser: every pattern-let form builds the head and accepts `: TYPE` before `=`. - Sema: check_let_else sets pattern_bind_mut around check_pattern, and each binding site in check_pattern uses it. The annotation demands the subject's type and drives its inference through check_binding_annotation, which is now shared with the named `let x: T` check. - check_binding_annotation also rejects an aggregate whose element representation differs from the annotation (`let t: (i64, i64) = pair()` with pair -> (i32, i32)). Both spellings used to reach codegen as invalid MIR. Constructors lowered against the annotation are unaffected. - MirLower: pattern-let binding locals carry var's mutability; an annotated subject lowers against the annotation. - Resolve walks the annotation. render prints var, the annotation, and `else` only when there is one. - expr_may_suspend / expr_creates_ephemeral_task walked a let-else's pattern (d0) as though it were its value. They walk d1 now. `for` patterns stay immutable: FOR_STMT has no var or mut (§30.4). Tests: behav_var_destructure_mutable, behav_let_pattern_annotation, da_var_destructure_owned_moves_once (leak count 0), and compile-error fixtures for let tuple/nested/struct/let-else immutability, D12 scalar receivers, annotation mismatch/width/arity, and the named-let width case. (cherry picked from commit a7e2004) (cherry picked from commit 7fec2a143214f00f0f121fea8767f3d4750126b3)
…rename (new inode) + `<dest> version` verified against the source Root cause: src/main.w cli_fast_install_blessed (the #702 fast path that `:install-user` takes before any graph evaluation) wrote the compiler with `with_fs_write_file(dest, data)` -- rt_core fs_write_file_c, open(O_WRONLY| O_CREAT|O_TRUNC) -- into the existing ~/.local/bin/with, then chmod. Same inode, no rename, no launch check. The .Install kind's temp+rename+verify (build.w install_compiler_target, verify=version) never ran for `:install-user`: the graph target is shadowed by the fast path. 2026-09-22: the installed inode stayed 39417163 across the install, success was printed, and macOS SIGKILLed the next launch (137). Reproduced against a scratch $HOME with a hard link to the installed file: the installed compiler's fast path leaves the destination at its old inode (dest and alias both 54577347 after); the fixed stage1 gives it a new one (dest 54576089 -> 54577347, alias still 54576089) and the installed file runs. Fix: build_graph_install_path is the one install placement -- the .Install kind and the fast path both call it. Temp sibling + chmod + rename (fresh inode, mode set before the rename); with verify, `<source> <subcommand>` runs first (a source that cannot start is not installed) and `<dest> <subcommand>` must exit 0 with identical stdout, one fresh-inode retry, then a loud failure. Verification now checks output, not only the exit status. Test: behav_build_install_atomic_verify -- a hard link to the old destination keeps the old bytes (new inode) for a plain file and for a signed executable (the compiler and the test binary itself) installed over one that has run; the installed file launches and prints what its source prints; verification fails for a non-executable destination, a non-zero exit and a mismatched output; a source that cannot start installs nothing. An in-place-write mutation of the placement fails the test. The fast path lives in the compiler, so it takes effect for compilers built from this commit: the next `:install-user` run by an older binary (the pinned seed, or a release binary built before this) still writes in place. (cherry picked from commit 6c7f036)
5f550b3 to
3c811cc
Compare
|
Battery (seed-driven, with :drop-audit/:move-audit) on main 43796ac + #1400 → #1370 → #1371 → #1397 (head c846339, including the #1385 lower_let_else merge resolution): build ok, :fixpoint ok, :drop-audit ok, :move-audit ok, :test ok (no reds), :test-green ok, :last-green ok. Merge in order #1370, #1371, #1397 (#1400 already merged). |
Root cause.
src/main.wcli_fast_install_blessed(the #702 fast path:install-usertakes before any graph evaluation, main.w:2930) wrote the compiler withwith_fs_write_file(dest, data)(rt_corefs_write_file_c:open(O_WRONLY|O_CREAT|O_TRUNC)) into the existing~/.local/bin/with, then chmod. The file kept its inode, nothing was renamed, and nothing launched it. The.Installkind's temp+rename+verify=version(build.winstall_compiler_target) never ran for:install-user, because the fast path shadows the graph target. On 2026-09-22 the installed inode stayed 39417163 across an install that printed success, and macOS SIGKILLed the next launch (137).Evidence. Both runs used a scratch
$HOMEwith a hard link to the installed file:version.Fix.
build_graph_install_path(BuildGraphOps.w) is now the only install placement. The.Installkind and the fast path both call it:verify=, it runs<source> <subcommand>first. A source that can't start installs nothing.<dest> <subcommand>must exit 0 and print the same stdout as the source. On failure it retries once through a fresh inode, then fails loudly.Runtime-object and green-store installs have no
verify=and go through the same placement as before.Test.
test/behavior/behav_build_install_atomic_verify.w:A mutation that writes in place fails the test at the hard-link check.
Takes effect only in compilers built from this change. An older binary (the pinned seed, or any release binary built before this) still writes in place on
:install-user.Iterate tier only:
:devgreen, and the new test plusbehav_build_cache_install_pathspass under stage1. Draft until the battery is green.