You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Linking stage1 fails with undefined symbol ___closure when a compiler module calls List[str].sort() #2618
Seen while adding src/CiContracts.w (D159 campaign, #2615) on main 0b6e230 under the pinned seed nightly-20261024-local-4-0cca9aee2744. A compiler module doing
var names: List[str] = List.new()
…
names.sort()
builds src/ with the seed to completion and then stage1 fails to link: ld64.lld: error: undefined symbol: ___closure. List.sort (std.algorithms) reaches ord_compare[T], which returns a closure written inside a generic function; the instantiation for T = str from a compiler module produces a reference to the closure symbol but no definition in the stage1 object set. A user program calling List[str].sort() compiles and runs (behav_list_sort), so the shape is specific to the compiler build (the seed compiling src/ as one unit set; #1135's class, a closure in a generic function, in its link form).
Workaround in CiContracts.w: an insertion sort by < on str, noted in a comment; remove it when this is fixed.
Repro: on a worktree of main, add the three lines above to any src/*.w function that runs at startup, then WITH=$PWD/src/main src/main build :dev and read the link error.
Fixed in #2620 (main 2083b59): gen_closure created the closure function with external linkage; the multi-unit build strips every external body a unit does not own, so an instance in unit 1 returning a closure linked against an undefined ___closure. Internal linkage, as the thunks and environment helpers already had. Fixture test/behavior/behav_codegen_units_closure_in_generic.w (WITH_CODEGEN_UNITS=8) fails on the previous stage1 and passes on this one. CiContracts keeps its insertion sort until a seed carrying the fix is pinned (the pinned seed must still link stage1).
Activity
Migrator contracts, step 1 (D159, #2615): the contracts artifact, bes…
Fix the four bugs filed today instead of fixed: closure linkage acros…
ehartford commentedon Oct 25, 2026
Fixed in #2620 (main 2083b59): gen_closure created the closure function with external linkage; the multi-unit build strips every external body a unit does not own, so an instance in unit 1 returning a closure linked against an undefined ___closure. Internal linkage, as the thunks and environment helpers already had. Fixture test/behavior/behav_codegen_units_closure_in_generic.w (WITH_CODEGEN_UNITS=8) fails on the previous stage1 and passes on this one. CiContracts keeps its insertion sort until a seed carrying the fix is pinned (the pinned seed must still link stage1).
Pin the joint seed nightly-20261025-local-1 and retire the seed-bound…