I have this code :
trait State:
fn to_string(self) -> String:
...
struct StateTtt(State):
fn __init__(inout self):
pass
fn to_string(self) -> String:
return "ABC"
fn get_state() -> State:
return StateTtt()
fn main():
var s = get_state()
print(s.to_string())
But it gives me the error :
“cannot implicitly convert ‘StateTtt’ value to ‘State’ in return value”
But the StateTtt struct implements the State trait, so why it cannot be converted ?
Of course this is a simplified version of my code. In the real code the getState function will create a struct instance based on a paramenter.