Skip to content

Commit

Permalink
frontend: Extend test for default trait methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Oct 15, 2024
1 parent 0e6d560 commit 89c067b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/trait/trait-default1.dora
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
trait Foo {
fn f(): Int64 { 0}
fn f(): Int64 { 0 }
fn g(): Int64 { 2 }
}

impl Foo for String {
fn f(): Int64 { 1 }
}

impl Foo for Bool {
fn f(): Int64 { 101 }
}

fn main() {
let a: String = "foo";
assert(a.f() == 1);
assert(a.g() == 2);

let a: Bool = true;
assert(a.f() == 101);
assert(a.g() == 2);
}

0 comments on commit 89c067b

Please sign in to comment.