I expect the following script to pass all asserts trait Greetable { > def greeting() { "Hello!" } > } > class RegularPerson {} > class VerySpecialPerson implements Greetable { > def greeting() { "Whazzup?" } > } > class SpecialPerson { > def greeting() { "Pleased to meet you" } > } > assert (new RegularPerson() as Greetable).greeting() == "Hello!" > assert (new VerySpecialPerson() as Greetable).greeting() == "Whazzup?" > assert (new SpecialPerson() as Greetable).greeting() == "Pleased to meet > you"
But the last assert is not passing. Instead the result is hello! It seems to me that inheritance does not works when using Traits at runtime. Is it the expected behaviour? Is there a workaround?