Repository navigation
Merged
Conversation
added 3 commits
October 2, 2026 10:13
…1955) src/main.w, src/CodegenDispatch.w and src/compiler/Frontend.w use StringBuilder with no import. They compile only through the order-dependent leak #1955 describes (a bare `use compiler.Link` exposes Link's own `use std.string.StringBuilder` to the importer when Link's bodies are checked first). On win10 the leak does not happen for the backslash spelling of the path: > out\bootstrap\bin\with-stage1.exe check src\main.w error: 'StringBuilder' requires an explicit import (§18.1); add: use std.string.StringBuilder --> src\main.w:547:15 > out\bootstrap\bin\with-stage1.exe check W:/verify-2/src/main.w ok The explicit import is what §18.1 requires; the leak itself is #1955.
`module_visible_no_prelude` followed every module's import edges, so a bare `use compiler.Link` let Link's `use std.string.StringBuilder` resolve `StringBuilder` in the importer with no import of its own. lldb on `check leak.w` (stage1, fix-1955 tree): the walk for `noprelude|leak.w-><embedded-std>/std/string.w` pushed edges at Sema.w:4035 from current = 2 (leakmod/helper.w: neither the start module nor std) and returned 1 at Sema.w:4012 into decl_visible_from_current_gated (Sema.w:3903) from lookup_named_type_filtered (Sema.w:4293). The walk now continues only from the start module, through the std tier (§18.2 tier 5), and inside a bundle corpus (D39 §3.4), as module_is_visible_from_current already does. The issue named the `named_tid` return at the end of lookup_named_type_filtered. It is not the leak: lldb over `check src/main.w` (148k stops) and `check rt/rt_core.w` (38k calls) takes it only for sym 42, `Self`, with saw_recorded = 0, and deleting it made the stage1 compiler reject rt/rt_core.w (`impl str:` bodies saw `&<error>`). It is the scoped-binding tier: `Self` and generic type parameters are written straight into `named_types` (SemaCheck.w bind/restore of syms.self_type and tp_sym, SemaDecl.w, ComptimeEval.w, MirLower.w) with no candidate record, so "a tid no candidate carries" is exactly a scoped binding and never an unimported declaration. Named scoped_type_binding and documented; its inputs are arguments so -O1 keeps them readable in lldb. Fixture: err_1955_import_gated_name_not_transitive.w with lib/issue1955/uses_string_builder.w; `ok` on the unfixed stage1 in both body orders, red in both after the fix (sema-order-check covers it both ways).
With the import walk closed, every root in the tree was checked with the fixed stage1 and the unfixed compiler; the §18.1 diagnostics that appeared only with the fix were applied by tools/insert_std_uses.w from the compiler's own `; add: use M.N` contract, looping until `check src/main.w` is clean: HashMap in Codegen, CodegenTraits, Analysis, AnalysisResolution, Lsp, compiler/Compilation and the issue61_queries orchestrator; StringBuilder in two c_import behavior tests; int_to_string in six d_acceptance tests. build.w, lib/std/build.w, tools/*.w, examples/ and uat/fixtures needed none.
…1955) native-phase-tests ran this root only in the battery, after the sweep: it reached print_i32 through compiler.Frontend's imports, which §18.1 no longer leaks. The same fix the sweep applied everywhere.
Contributor
Author
|
Battery GREEN on stack top 7bdd704 (seed-driven, |
ehartford
marked this pull request as ready for review
October 2, 2026 22:30
This was referenced Oct 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1955. Supersedes #1957 (its commit is included).
Root cause (lldb on stage1):
Sema.module_visible_no_prelude(Sema.w ~3992–4035) followed every module's import edges, so an importer saw whatever its imports imported; its siblingmodule_is_visible_from_currentalready stops at user modules. Thenamed_tidfallback the issue named is not the leak: a breakpoint acrosscheck src/main.w(148k stops) andrt/rt_core.wfires only for scoped bindings (Self, generic params), which are inserted into named_types directly with no candidate record; removing it breaksimpl str:bodies. Renamedscoped_type_bindingwith a comment.Fix: the walk continues only from the start module, through std-tier modules (§18.2 tier 5), and inside a bundle corpus (D39 §3.4) — the same rule as the sibling. Fixture err_1955_import_gated_name_not_transitive.w:
okin both body orders before, §18.1 error in both after; sema-order-check 0 of 1608. Fallout swept over 4,228 roots with tools/insert_std_uses.w: 15 files (+3 from #1957) gained an explicit import; build.w, lib/std/build.w, tools, examples, UAT: none. Gate green (54 targets).Caveat: the win10
check src\main.wvscheck W:/…disagreement is path spelling, not body order (seven shapes agree in both orders on macOS); likely the strict path-key branch at ~3992–3995 — unverified on win10.