f[i64?](x)Open and answer this issue on GitHub.
bug, ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments
Found by the j2 builder of #1019 (grammar rules take type parameters). Where a type is expected, List[i64?] parses. In an expression, though, the brackets of a call are read as an index or a slice, so ? stops the parse. This holds for functions and grammar rules alike (G::entry[i64?](input)).
Probe:
fn id[T](x: T) -> T { return x }
fn main() {
let a: i64? = id[i64?](null)
print("${a ?? 0}")
}
Error: Expected `..` or `]` here, but found `?`.
--> n.nika:3:25
Type arguments at a call take any type (Part II, generics), and no ADR refuses a nullable one, so this is a defect.
To build
name[...] followed by ( parses its brackets as a type list when they hold a type form (T?, and the other suffixes and forms only a type has), not as an index.tests/compiler/generic_call_with_a_nullable_type_argument.nika, covering both a function and a grammar rule.