Result: done Files: crates/nikaia-std/src/tools/check_overflow.nika crates/nikaia-std/src/tools/check_texts.nika crates/nikaia-std/src/tools/lowered/check_overflow.rs crates/nikaia-std/src/tools/lowered/check_texts.rs crates/nikaia-std/src/tools/lowered.rs tests/compiler/tests/tuple_option_part_in_arms.nika tests/compiler/tests/tuple_option_part_in_arms.stdout assets/badges/self-hosted.svg Commit: check: a tuple at a match or if end wraps its optional parts (Fixes #1088) Body: check_overflow_list_into_nullables now hands an if, a match or a block to the new check_overflow_ends_into_nullables. When every end is a tuple literal or null (ends_in_tuple / tuple_ends of check_texts.nika, now pub), it wraps each tuple end part by part through check_overflow_tuple_into_nullables. Each end is compared with its own type, read from state.arm_types by the end’s id (recorded per arm and per branch tail, #596), falling back to the joined type. The join (i32, String?) would make s.clone() look nullable already. The tail, return, typed let and argument paths all reach it through check_widened_slot. The rule is now repeated in check_overflow_tuple_into_nullables, check_overflow_ends_into_nullables and check_texts.nika tuple_literal (which walks the same ends for text tiers). The test adds a text-literal end and nested ends (a match arm holding an if and a block) to rows a-e. Fixes: #1088 Tests: rows a-e reproduced on the unfixed binary (nikaia-suite target/fast): E0308 “Mismatched types” at each; tuple_option_part_in_arms fails there (8 rustc errors) and passes now; nikaia test –both-settings over the 73 tests/compiler programs named tuple|nullable|option|tail|widen (copied to a scratch project with src/main.nika): 73 passed both settings; lower-std fixpoint clean (second run unchanged); cargo fmt –check, clippy 1.97 -D warnings, pre-push-check.sh green; clippy 1.99.1 -D warnings green Gate: green Deviation: none Found: pre-existing checker refusal (also on the unfixed binary), not the E0308 of #1088: a function returning match x { 0 => (1, null), else => (2, "lit") } under -> (i32, String?) is refused NK1104 “You’re returning (?, ref String)” when its result and another function’s owned (2, t.clone()) result both go to one show(r: (i32, String?)) parameter. Alone or through let (a, b) = literal(1) it passes. Probe: fn other(t: String) -> (i32, String?) { return (2, t.clone()) }; fn literal(x: i32) -> (i32, String?) { return match x { 0 => (1, null), else => (2, “lit”) } }; fn show(r: (i32, String?)) { let (a, b) = r; println(f”{a} {b ?? “none”}”) }; main: show(literal(1)); show(other(“t”)). Suspect text tiers of a tuple parameter (text_tiers.nika / check_texts.nika tuple_literal). The test calls literal through a let. Needs: none Changelog: A tuple with a T? part at an end of a match, an if or a block now wraps that part in Some as the same tuple written directly does (#1088). Owner: none Disk freed: under 1 GB (clippy-1.99 target dir removed); cache 3.0G, 6.6G free; new cache entry over 100 MB: build-time-parsers/768d2772d43bb4cc 1030 MB Rs2nika: none Pushed: local 54503278335be6f896c6a88a3649941356c14523

This site is open source. Improve this page.