Open and answer this issue on GitHub.
ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments
Found by the builder that reworked scripts/drive.nika (eca460c), which wrote exe.clone() at two call sites to get past it; those come out once this is fixed.
fn pick() -> String throws {
for s in ["a", "b"] {
if s == "b" { return s.to_string() }
}
return ""
}
fn take(s: String) throws {
println(s)
}
fn main() throws {
let s = pick()
if s == "" { return }
let mut i = 0
while i < 2 {
take(s.clone())
i += 1
}
take(s)
}
nikaia check: error[NK1104]: You're returning ref String, but the function is declared to return String at s.to_string() (3:30). to_string() gives text of its own; the refusal is wrong.
s.to_string() on a for element of a string-literal array is typed ref String once the caller moves the result after a loop (suspected: the checker’s typing of the literal array’s element; not traced).tests/compiler/ with its .stdout (three lines b), at both settings.exe.clone() workarounds in scripts/drive.nika (eca460c).Generated by Claude Code