Skip to content

Iteration of thunks is broken #369

@mzgubic

Description

@mzgubic
julia> t = @thunk([1.0, 2.0, 3.0]);

julia> for i in t
           println(i)
       end
1.0
2.0
3.0
ERROR: MethodError: no method matching iterate(::Nothing)
Closest candidates are:
  iterate(::Union{LinRange, StepRangeLen}) at range.jl:664
  iterate(::Union{LinRange, StepRangeLen}, ::Int64) at range.jl:664
  iterate(::T) where T<:Union{Base.KeySet{var"#s79", var"#s78"} where {var"#s79", var"#s78"<:Dict}, Base.ValueIterator{var"#s77"} where var"#s77"<:Dict} at dict.jl:693
  ...
Stacktrace:
 [1] indexed_iterate(I::Nothing, i::Int64)
   @ Base ./tuple.jl:89
 [2] iterate(#unused#::Thunk{var"#5#6"}, ::Tuple{Vector{Float64}, Int64})
   @ ChainRulesCore ~/JuliaEnvs/ChainRulesCore.jl/src/differentials/thunks.jl:12
 [3] top-level scope
   @ ./REPL[37]:2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions