Skip to content

§13.3 (#2943): every operation of the collection table compiles and runs as written - #3006

Merged
ehartford merged 2 commits into
d186-iterable-zipfrom
s13-3-collection-ops
Nov 3, 2026
Merged

ehartford merged 2 commits into
d186-iterable-zipfrom
s13-3-collection-ops

Conversation

@ehartford

@ehartford ehartford commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2943. Layer 2 of stack #3008 (on #3002).

std gains chunks, windows, dedup, unique, intersperse, scan, flatten (three twins by element: views of Lists, Iter elements, IntoIter elements), peekable, sorted, sorted_by, group_by and the five Iter.* constructors (iter_ctor_*, routed in check_qualified_trait_call, a static call MIR lowers without a receiver). Each adapter has a _views twin over views of Copy elements, as collect and sum have. sorted/sorted_by sit beside sort in std.algorithms, which the prelude now makes ambient (xs.sort() needs no import any more; +~30 ms on a hello-world check). filter_map over Copy views hands f the value; the take_while views twin returned a bare element. shape() (D119) is typed by Sema and lowered as an aggregate of isize.

The parser's E0951 pre-check is removed: D161 makes the nesting Sema's call by the parameter's type (map(if it > 2: twice(it) else: it) is one closure); Sema's own E0951 still refuses map(it.children |> filter(it.active)).

Fixtures behav_s13_3_{lazy_adapters,consumers,constructors}, behav_d119_shape; the §13.3 row flips to implemented. Found: #3004 (an iterator over a collection literal bound to a variable reads a dead temporary); map(Some(it)) over views ICEs with #1438.

Census: lib clone-call rises by 6 (generic adapters that retain and yield a T: dedup, unique, intersperse, repeat; group_by_views clones its key for the origin analysis).

…uns as written

std gains chunks, windows, dedup, unique, intersperse, scan, flatten,
peekable, sorted, sorted_by, group_by and the five Iter.* constructors
(iter_ctor_*), each adapter with a _views twin over views of Copy
elements as collect and sum have. sorted and sorted_by sit beside sort in
std.algorithms, which the prelude now makes ambient. filter_map over Copy
views hands f the value (iter_filter_map_views); the take_while views
twin returned a bare element (now Some(x)). shape() (D119) is typed by
Sema (seq_shape_result_type) and lowered as an aggregate of isize
(MethodLowering.SeqShape). Iter.empty() and friends are static calls Sema
routes in check_qualified_trait_call and MIR lowers without a receiver
(iter_ctor_call_nodes). The parser's E0951 pre-check is removed: D161
makes the nesting Sema's call by the parameter's type, and Sema's own
E0951 still refuses a true nesting.

Fixtures behav_s13_3_{lazy_adapters,consumers,constructors} and
behav_d119_shape; the §13.3 conformance row flips to implemented.
@ehartford
ehartford added this pull request to stack #3008 November 3, 2026 06:52
@ehartford ehartford changed the title s13 3 collection ops §13.3 (#2943): every operation of the collection table compiles and runs as written Nov 3, 2026
… no RNG or sync state

The prelude's std.algorithms import loaded std.random and so std.sync
into every unit (the receiver-surface audit then saw sync's 22 explicit
receivers). shuffle moves beside the RNG it draws from; sorting stays
free of it. The constructor route passes its lists bare (auto-ref); the
six lib clone calls the generic adapters need are granted.
ehartford pushed a commit that referenced this pull request Nov 3, 2026
…missions retire

peekable and the constructors are implemented (#3006); the peekable
refusal has no replacement to pin, and Iter.empty() with nothing to bind
its element type now says what would bind it (err_iter_empty_unbound_element).
@ehartford
ehartford marked this pull request as ready for review November 3, 2026 08:21
@ehartford
ehartford merged commit 8393074 into main Nov 3, 2026
@ehartford
ehartford deleted the s13-3-collection-ops branch November 3, 2026 08:22
ehartford added a commit that referenced this pull request Nov 3, 2026
…owned by open issues (#3015)

* #2950: the compiler's admissions — two comptime gaps closed, the rest owned by open issues

A format spec in a comptime f-string formats through the runtime's spec
writers, as a runtime f-string does (fstring_spec_text; ':?' is still
refused, loudly). A variant with a payload, and a bare variant of a
payload-carrying enum, are comptime values (CV_ENUM) and fold back into
source as the shorthand with its payload (ComptimeTransform). A comptime
read of a name the unit never declared says so on the release compiler
too (eval_ident, #2949). The four admissions that stay are re-cited to
their open owners: #3012 REPL declarations, #3013 UAT 'expect image:',
#3014 bitfields in member records, #3010 the retained variadic case,
#3011 the C backend's key projection.

Fixtures behav_2950_comptime_fstring_spec, behav_2950_comptime_payload_variant.

* #2950: the layer's own ceremony trimmed; the two field moves granted (D32)

* #2950: the seed predates D183; the one len cast stays, granted

* #2950: a payload variant call stays unfolded (#3016); the shorthand fold serves comptime blocks only

Folded to its shorthand, AppError.Db(DbError.NotFound("users", "42"))
no longer matched .Db(.NotFound(..)) at run time (spec_ss18_6 on the
battery). ct_try_fold_type_call leaves an enum value with a payload as
the call it was written as; the fold still embeds a comptime block's
result (behav_2950_comptime_payload_variant).

* §13.3: the two refusal fixtures of the old peekable and Iter.empty admissions retire

peekable and the constructors are implemented (#3006); the peekable
refusal has no replacement to pin, and Iter.empty() with nothing to bind
its element type now says what would bind it (err_iter_empty_unbound_element).

---------

Co-authored-by: Eric Hartford <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant