ozgunozerk/state-shift

๐Ÿž [Bug]: fn type definitions/lifetimes are lost

Closed this issue ยท 3 comments

What happened?

#[require(Initial)]
fn foo<'bar, T> (&'bar self, obj: T) -> Result<()> {
}

The custom lifetime and T will be lost.

Expected behavior

No response

Hang on, that may be because it was a function that returned a Result instead of "Self"? Did not have time to investigate further.

Hang on, that may be because it was a function that returned a Result instead of "Self"? Did not have time to investigate further.

Quite possible. I only thought of returning Self when I was writing this macro. Will investigate soon, thanks!

@jkneer

previously we were only retaining the lifetimes and generics for the struct, but not methods.

Now, we are also retaining the full signature of the methods.

In addition, I added support to enable wrapping the struct in complex types like Result<Option<Struct>> for the methods
in both return type and in the body.

Thanks for the code snippet you shared, helped me address both of the issues!