Flash 27 lines
// REJECT probe — runaway instantiation is capped: direct self-application
// re-enters one key, growing-argument recursion mints a fresh key per
// level; each is reported once, at the recursive application. A definite
// error written in a generic's body also reports exactly once despite
// instantiation (the loud body walk owns it; the quiet instance evaluation
// must not duplicate it).
fn Self(comptime T type) type {
return Self(T) // expect-error: generic 'Self' exceeds the instantiation depth limit (64)
}
fn Grow(comptime T type) type {
return Grow(?T) // expect-error: generic 'Grow' exceeds the instantiation depth limit (64)
}
fn Box(comptime T type) type {
return T
}
fn Bad(comptime T type) type {
return Box(T, T) // expect-error: generic 'Box' expects 1 argument, found 2
}
const A = Self(u8)
const B = Grow(u8)
const C = Bad(u8)