JuliaVariables.jl icon indicating copy to clipboard operation
JuliaVariables.jl copied to clipboard

Incorrect handling of `setindex!` expressions

Open MasonProtter opened this issue 3 years ago • 1 comments

x should be global in both of these:

julia> solve_from_local(:(x[] = 1))
:($(Expr(:scoped, (bounds = Var[@local x], freevars = Var[], bound_inits = Symbol[]), :((@local x)[] = 1))))

julia> solve_from_local(:(setindex!(x, 1)))
:($(Expr(:scoped, (bounds = Var[], freevars = Var[], bound_inits = Symbol[]), :((@global setindex!)(@global x, 1)))))

MasonProtter avatar Aug 10 '22 21:08 MasonProtter

Maybe the solution is having simplify_ex turn x[inds...] = y into setindex!(x, y, inds...)?

MasonProtter avatar Aug 10 '22 21:08 MasonProtter