JuliaDynamics / ResumableFunctions.jl

C# style generators a.k.a. semi-coroutines for Julia.
Other
160 stars 19 forks source link

Structs do not work as an annotated return type for a resumable function #29

Closed 8uurg closed 5 years ago

8uurg commented 5 years ago

Example:

struct Simple
    a :: Int64
end

@resumable function thisdoesnotwork(n :: Int64) :: Simple
    @yield Simple(n)
end

for a in thisdoesnotwork(10)
    println(a)
end

Causes the following error for me

ERROR: MethodError: Cannot `convert` an object of type Bool to an object of type Simple
BenLauwens commented 5 years ago

Thanks for the report! Bug should be fixed in master. Can you verify?

8uurg commented 5 years ago

Looks like it works. Thank you!