# Nothing implements a sealed trait, so no type or trait names it, it bounds # nothing, no type is one, and nothing refers to it. It holds only constants # and types, each given here, and composes no trait. Its constants are read # through it given its type arguments, and where one fails, what it tests # fails. A trait constant's default is taken only by a type naming the trait. @sealed pub trait closes { const value := T is closeable; } @sealed pub trait owns { const value := T is owning; } trait shown { def show(&this): void; } @sealed trait wrong : shown { def f(): u8; const bare: u64; type open; type bounded: copyable = u8; } trait sized { const n: u64 = 4; } struct implements : closes { var x: u8; } trait composes : closes {} def bounded(x: T): void where T: closes {} def tests(x: T): u8 { if const T is closes { return 1; } match const T { closes => return 2; else => {} } return 3; } def refers(r: &closes): void {} def unnamed(): bool { return closes::value; } def counted(): bool { return closes::::value; } type pick = T is closes ? u8 : u16; def value_test(x: u8): bool { return x is closes; } def shut(x: &mut T): void { if const !owns::::value { x.close(); } } struct shaped { var a: u8; } def total(): u64 where T: sized { return T::n; } def main(): void { val n := total::(); }