LYR-SEM0020
a conformance that leaves an interface member unimplemented
A type or a conformance block declares an interface but does not implement one of its abstract methods, or does not answer one of its static lets.
Explanation
A conformance :: [I] promises every member of I. A method with a default in the interface is inherited; every method without one, and every static let the interface declares, has to be written by the conforming type.
Implement the missing member, with the signature the interface declares.
Wrong
interface Named {
fn name(): string;
fn id(): int;
}
struct Tag :: [Named] {
fn name(): string { return "tag"; }
}
fn main(): void {
let _ = Tag { }.name();
}
Right
interface Named {
fn name(): string;
fn id(): int;
}
struct Tag :: [Named] {
fn name(): string { return "tag"; }
fn id(): int { return 1; }
}
fn main(): void {
let _ = Tag { }.name();
}