You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nested generic type receiver is unavailable in comptime type.implements #589
A nested generic type used directly as a comptime type-method receiver is rejected as though the receiver were a runtime value.
Minimal reproduction
use std.rc
const BAD: bool = comptime Arc[Rc[i32]].implements(Send)
Expected
The receiver Arc[Rc[i32]] is a type expression, so .implements(Send) should evaluate at comptime just like Arc[i32].implements(Send) and named aliases do.
Actual
The compiler reports:
error: runtime value is not available at comptime
--> repro.w:3:28
3 | const BAD: bool = comptime Arc[Rc[i32]].implements(Send)
| ^^^
Workaround used
Name the nested generic type first:
type NestedArcRc = Arc[Rc[i32]]
const OK: bool = comptime NestedArcRc.implements(Send)
Found while implementing #473 Send/Sync enforcement tests.
Fixed by the commit above: static_type_expr's NK_INDEX branch now CREATES the receiver's generic instantiation on demand (ensure_generic_inst_type) instead of requiring it to already exist somewhere in the program. comptime Arc[Rc[i32]].implements(Send) evaluates (to false — Rc poisons Send transitively, which is the semantically correct answer). Pinned by behav_comptime_implements_generic_inst. Probe note: the boundary was never nesting depth — single-level Arc[i32] failed identically when not instantiated elsewhere. §17.2; full gates green.
Activity
ehartford commentedon Jul 3, 2026
Fixed by the commit above:
static_type_expr's NK_INDEX branch now CREATES the receiver's generic instantiation on demand (ensure_generic_inst_type) instead of requiring it to already exist somewhere in the program.comptime Arc[Rc[i32]].implements(Send)evaluates (to false — Rc poisons Send transitively, which is the semantically correct answer). Pinned by behav_comptime_implements_generic_inst. Probe note: the boundary was never nesting depth — single-levelArc[i32]failed identically when not instantiated elsewhere. §17.2; full gates green.Fix #589: comptime type receivers create their instantiation on demand