Open and answer this issue on GitHub.
ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments
A comptime binding inside a non-generic function that calls one of the program’s own functions is refused with NK1127 “This compiler couldn’t build the program that computes it, which is this compiler’s fault.” Part II 10.2 says a comptime calls the program’s own functions; the same call at the top level or inside an unrolled turn works. Found by the tools lane (j5, #1087); also on the compiler before j5.
fn shout(s: String) -> String {
return f"{s}!"
}
fn g() -> String {
comptime T = shout("x")
return T
}
fn main() {
println(g())
}
Today: error[NK1127]: T can't be computed while the program is built. at 6:2. Wanted: x!.
crates/nikaia-std/src/tools/comptime_tree.nika comptime_sub_program / comptime_computed (the DidNotBuild arm): the generated sub-program’s Rust is under ~/.cache/nikaia/ (ls -dt, newest first); rustc’s error there names what is missing.
x!; test tests/compiler/tests/a_comptime_in_a_function_calls_a_function.nika + .stdout, failing once on the compiler without the fix.For the bug lane (no wip: no lane holds it yet).
Generated by Claude Code