Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xunilrj committed Oct 24, 2024
1 parent 4c6ca5b commit 0407765
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,27 @@ impl<K> CallTrait<K> where K: Trait {
}
}

// https://github.com/FuelLabs/sway/issues/6382
trait Devour<T> { fn eat(t: T); }
struct Brain { }
struct Zombie { }

impl Devour<Brain> for Zombie {
fn eat(_b: Brain) { }
}

fn feed<T, U>(t: T) where U: Devour<T> {
U::eat(t);
}

fn main() -> bool {
let _ = call_trait(1);
let ct = CallTrait::<u64> {};
assert(ct.call_trait(1) == 42);

// https://github.com/FuelLabs/sway/issues/6382
let b = Brain{};
feed::<Brain, Zombie>(b);

true
}

0 comments on commit 0407765

Please sign in to comment.