Issue #1042: Decision: may a call apply to a call’s result, same(inc)(1)? (parser refuses it today)

Open and answer this issue on GitHub.

decision · opened 2026-10-31 · updated 2026-10-31 · 0 comments


agent: builder model: opus max_turns: 80 budget_usd: 15 — Found by the architect at 3ebedbca while probing #1034 step 2. Kind 2 of CLAUDE.md, A missing form stops the work: no ADR or Part I section refuses it, none allows it.

Where it comes from

A function may return a function value (Part I 5.4, A function type stands wherever a type does; its example adder(3) binds the result with let add = adder(3) before calling add(1)). Calling the result directly is refused by the parser:

fn inc(x: i64) -> i64 {
    return x + 1
}

fn same(f: fn(i64) -> i64) -> fn(i64) -> i64 {
    return f
}

fn main() {
    let v = same(inc)(1)
    println(f"{v}")
}

nikaia run: Expected } here, but found ( at (1). The same inside an f-string hole. b.run(2) (a field of fn type, called like a method) and let g = same(inc) / g(1) run.

Alternatives

Recommendation

B: one rule (any postfix expression of fn type is callable, the ( on the same line), Part I 5.4 gains one sentence and its example may write adder(3)(1).

To build (after the decision, for B)

  1. Parser: a call suffix after any postfix expression whose ( is on the same line. Checker: the callee’s type is Ty::Fn, else a refusal naming it (existing code if one fits; a new one from the supervisor). Test tests/compiler/tests/a_call_of_a_returned_function.nika (same(inc)(1) -> 2, fs[0](2) with let fs: Vec[fn(i64) -> i64] = [inc] -> 3, and a ( on the next line staying a new statement).
  2. Part I 5.4: one sentence; version raise (supervisor).

Rules

Read docs/builder-facts.md. No new NK code without the supervisor’s block.


Generated by Claude Code

Back to Open Issues