Result: done Files: crates/nikaia-std/src/tools/check_core_leaves.nika crates/nikaia-std/src/tools/check_core_stmt.nika crates/nikaia-std/src/tools/check_core_flow.nika crates/nikaia-std/src/tools/check_takes.nika crates/nikaia-std/src/tools/lowered/check_core_leaves.rs crates/nikaia-std/src/tools/lowered/check_core_stmt.rs crates/nikaia-std/src/tools/lowered/check_core_flow.rs crates/nikaia-std/src/tools/lowered/check_takes.rs docs/specification/30-nikaia-tooling.md tests/compiler/tests/an_element_read_handed_back_by_value.nika tests/compiler/tests/an_element_read_handed_back_by_value.stderr tests/compiler/tests/an_element_read_copied_with_clone.nika tests/compiler/tests/an_element_read_copied_with_clone.stdout Commit: check: an element read by last/first/get or a map, handed back by value, is NK1131 (Fixes #1044) Body: A let bound to X.first(), X.last(), X.get(i), a map’s X[k] or X.get(k) through ?? and a jump records the read as written in the local’s view_of when the element does not copy (CheckState::does_not_copy, the Variable arm’s old test, now shared); the read is told by facts.method_callees (Vec::first|last|get, the maps’ get) or facts.map_read_views (a map’s brackets). The Variable arm of check_core_a_lent_place_given_away refuses such a name with NK1131 naming the list and the help X.last()?.clone(); a new MethodCall arm refuses return path.last() the same way. The wording says the list keeps the element, owned or lent, so an owned local list reads right. a_changing_view (check_takes.nika) now asks written_mut for a view_of binding too: a for mut element always has it, a let of an element read changes nothing, and without it let members = contract.fails_with under such a let (emit_sums.nika:97) was taken for a part taken out of a view (NK2108). The workaround in check_core_flow_changed_copies is undone (state.scope.last()?.clone() ?? return). Part III NK1131 gains the sentence for element reads. Fixes: #1044 Tests: refusal test run on the unfixed binary (adf-era target/fast copy): check passed all six rows (a-d, f failed only in rustc, E0308), so the test failed there; on the fixed binary six NK1131, .stderr equal; clone test prints b a b c; Vec[String] and Vec[i64] row a still run; it borrowed_part borrowed_subject defects_found_running generics keeps nullable text_tiers traits map_reads mut_parameter_parts element_views views_handed_back views_kept option_defaults: 309 passed; nikaia-std –lib check_: ok; lower-std fixpoint clean, no refusal in tools/*.nika; sequences guard not worsened (green) Gate: red test (not this change: build lower-std fmt clippy pre-push green, guards green incl. sequences 24 passed; three whole-package runs failed different sets, 1 / 11 / 1 “settings disagree”, the third cut by another agent rebuilding target/fast/nikaia; all 14 failed tests pass together at both settings) Deviation: check_takes.nika (outside the brief’s file list) changed one line, a_changing_view, which the brief’s view_of reaches as a second reader; without it lower-std refuses emit_sums.nika with NK2108; committed on a gate red only from the whole-package run’s flakiness, see Gate Found: let s = path.last() ?? return null; return s.inner (a field of the element read, by value) still passes check and fails in rustc (cannot move out of s.inner); not in the brief, a follow-up issue Needs: supervisor: whole tests/compiler run flaky while other agents rebuild/run (yes-setting reports tests/compiler/src/main.nika NK2302 in place of the test) Changelog: An element read by first(), last(), get(i) or a map’s m[k]/m.get(k), handed back by value directly or through a let with ?? and a jump, is refused with NK1131 and the help …?.clone(), instead of reaching rustc (#1044). Owner: none Disk freed: scratch binaries removed; cache 1.8G, / 6.5G free (84%); new entries over 100 MB: rlib/af187e66 265M, run-bundle/3f8b93b8 286M Rs2nika: none Pushed: local 14b580c564a69841ec6027faf0560479ed79e71d

This site is open source. Improve this page.