Open and answer this issue on GitHub.
bug, ready · opened 2026-11-28 · updated 2026-11-28 · 0 comments
Found while “io::lines() reads into a fixed pool and yields views” (#2851), builder’s step 4 report, at 471b3124.
use std::collections
fn main() throws {
let mut seen: collections::BTreeSet[i64] = collections::BTreeSet()
{
let x = 1
seen.insert(x)
}
println(f"{seen.len()}")
}
nikaia run gives NK1343 “Internal compiler error … mismatched types”: the lowered block ends in seen.insert(x) without ;, so the block’s value is the bool the insert returns where () is expected. Expected output: 1. NK1343 itself says the checker accepted the code and Rust refused what it became.
A block statement’s value is discarded like any expression statement’s (Part I, statements). This is plainly meant: the checker accepts it.
Untraced. Suspected in crates/nikaia-std/src/compiler/emit_stmt.nika, where a bare block statement’s tail is emitted without EmitTail::Statement. Settle it with nikaia lower of the probe and by reading the block’s emission.
;). Test: tests/compiler/tests/a_bare_block_ending_in_a_call_with_a_value_runs.nika, .stdout (1).The probe prints 1, and the commit carries Fixes #N.
emit_stmt.nika and its lowered file; no Rust by hand.
Facts: Lowering and lower-std