ajhahn.de
← Flash
Flash 23 lines
// REJECT probe — argument kind is checked where the parameter's declared
// type resolves at file scope: a `type` parameter wants a type argument, a
// concretely typed one wants a value, and the kind resolves through a
// file-scope alias of `type` itself.

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

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

const MyT = type

fn Tagged(comptime T MyT) type {
    return T
}

const A = Box(5) // expect-error: argument 1 to generic 'Box' expects a type, found a value
const B = Ring(u8) // expect-error: argument 1 to generic 'Ring' expects a value, found a type
const C = Tagged(7) // expect-error: argument 1 to generic 'Tagged' expects a type, found a value