ajhahn.de
← Flash
Flash 39 lines
// PASS probe — well-formed generic applications stay silent: value and
// type position, annotations, a folded alias reused as a type, a container
// instance riding as a type argument, and a folded `?T` landing on the
// same structural type as its spelled form.

fn Box(comptime T type) type {
    return T
}

fn Ring(comptime n usize) type {
    return [n]u8
}

fn List(comptime T type) type {
    return struct {
        item T,
    }
}

fn Opt(comptime T type) type {
    return ?T
}

const B = Box(u8)
const C = Box([]u8)
const R = Ring(64)
const L = List(u8)
const Boxed = Box(L)
const Spelled = ?u8
const Folded = Opt(u8)

fn f(x Box(u8)) Box(u8) {
    return x
}

const Holder = struct {
    b Box(u8),
}