Result: done Files: crates/nikaia-std/std.contracts crates/nikaia-std/src/seq.rs crates/nikaia-std/src/tools/check_calls.nika crates/nikaia-std/src/tools/check_core_method.nika crates/nikaia-std/src/tools/check_facts.nika crates/nikaia-std/src/tools/emit_core_calls.nika crates/nikaia-std/src/tools/emit_core_places.nika crates/nikaia-std/src/tools/lowered/check_calls.rs crates/nikaia-std/src/tools/lowered/check_core_method.rs crates/nikaia-std/src/tools/lowered/check_facts.rs crates/nikaia-std/src/tools/lowered/emit_core_calls.rs crates/nikaia-std/src/tools/lowered/emit_core_places.rs docs/specification/30-nikaia-tooling.md docs/specification/adr/adr-384.md tests/compiler/tests/entry_or_default_seq_cloned.nika tests/compiler/tests/entry_or_default_seq_cloned.stdout tests/compiler/tests/entry_or_default_refused.nika tests/compiler/tests/entry_or_default_refused.stderr Commit: std: Entry::or_default and Seq::cloned (Fixes #1082) Body: ADR-384. Contracts Entry::or_default (sync, touches [], -> ref V) and Seq::cloned (sync, -> Seq[T] ends sized). Checker check_core_method_or_default: a collection, String, a number or bool passes through to Rust’s or_default; a struct whose fields all have defaults is recorded in the new fact defaulted_entries and lowered as .or_insert_with(|| V { defaults }) (lowered structs derive no Default; emit_place_all_defaults, sharing emit_place_field_default with the struct literal); any other V is NK1102 with help naming or_insert_with. check_core_method_cloned: the result’s items are unviewed; over views of non-copy values it lowers to Rust’s .cloned(), over owned items (after a map, or the .copied() walk of numbers) to nothing (new fact owned_clones, emitted in emit_core_method_arm). Seq::cloned joins a_paused_chain; Paused::cloned and Failing::cloned in seq.rs for a pausing chain over views. Part III names both; ADR-384 Accepted. Fixes: #1082 Tests: probe of #1082 on the unfixed binary: both NK1171 (both new tests fail there with NK1171); after: 1 2 2. New tests entry_or_default_seq_cloned (.stdout) and entry_or_default_refused (.stderr, NK1102) pass; nikaia test --both-settings --project tests/compiler 502 passed, 0 failed (incl. the tests named entry, seq, clone, map); nikaia-std --lib seq:: 4 passed; clippy 1.97 and 1.99.1, fmt, pre-push-check clean; lower-std fixpoint clean Gate: green Deviation: none Found: an f-string with no hole used as a method receiver keeps its doubled braces: let n = f"a {{ b }}".len() prints 9, not 7 (f"a {{ b }}".clone() gives a {{ b }}; with a hole, f"a {{ {x} }}".clone() is right); also [1, 2, 3].iter().filter(fn(x) { x > 1 }).sum() into let s: i64 reaches rustc (expected &&_, found integer), an open-number list in a lambda chain Needs: none Changelog: std: m.entry(k).or_default() puts in the value V() makes (a collection, String, a number, bool, a struct of defaults; another V is NK1102), and xs.iter().cloned() hands on a copy of each element (ADR-384). Owner: none Disk freed: 0.65 GB (1.99.1 clippy target dir); cache 3.0G, disk 8.3G free; new cache entry over 100 MB: build-time-parsers/768d2772d43bb4cc 1030 MB Rs2nika: none Pushed: local 887634a92bc17a48e6492a5a45501321eb190d61

This site is open source. Improve this page.