Skip to content

Nested generic type receiver is unavailable in comptime type.implements #589

Closed

Description

@ehartford

Summary

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.

Activity

  1. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    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.

  2. added a commit that references this issue on Jul 4, 2026
    5fc6160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions