Files

10 lines
675 B
Plaintext
Raw Permalink Normal View History

2026-10-26 10:14:11 -05:00
# A branch or arm checked once for each case it holds in says each note once,
# with the case where only that case finds it, and an undeclared name an `if
# const` tests by is said once.
def added<T>(x: T): T { if const T is pointer || T is integer { return x + x; } return x; }
def squared<T>(x: T): T { return match const T { integer, pointer => x * x, else => x }; }
def missing<T>(x: T): T { if const T is integer || T is real { return nothing_here; } return x; }
def target_bits<T>(): u64 { return size_of::<match const T { pointer, integer => T::target, else => T }>(); }
def unknown<T>(x: T): u64 { if const T is nowhere { return 1; } return 0; }
def main(): void {}