Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sl doesn't work as i had hoped if left-hand side indexes #323

Open
bjarthur opened this issue Dec 19, 2022 · 1 comment
Open

sl doesn't work as i had hoped if left-hand side indexes #323

bjarthur opened this issue Dec 19, 2022 · 1 comment

Comments

@bjarthur
Copy link

i would rather sl in the example below step into foo, and it does precisely that if line 3 of bar has y instead of y[2] in the LHS. is this the intended before, or a bug? is there a command to step into foo? thanks.

julia> using Debugger

julia> function foo(x)
       x+= 1
       return x
       end
foo (generic function with 1 method)

julia> function bar(x)
       y=1:3
       y[2] = foo(x[3])
       return y.+1
       end
bar (generic function with 1 method)

julia> x=1:100
1:100

julia> @enter bar(x)
In bar(x) at REPL[3]:1
 1  function bar(x)
>2  y=1:3
 3  y[2] = foo(x[3])
 4  return y.+1
 5  end

About to run: (Colon())(1, 3)
1|debug> n
In bar(x) at REPL[3]:1
 1  function bar(x)
 2  y=1:3
>3  y[2] = foo(x[3])
 4  return y.+1
 5  end

About to run: (getindex)(1:100, 3)
1|debug> sl
In setindex!(A, v, I) at abstractarray.jl:1341
 1341  function setindex!(A::AbstractArray, v, I...)
 1342      @_propagate_inbounds_meta
>1343      error_if_canonical_setindex(IndexStyle(A), A, I...)
 1344      _setindex!(IndexStyle(A), A, v, to_indices(A, I)...)
 1345  end

About to run: (IndexStyle)(1:3)
1|debug> 
@KristofferC
Copy link
Member

y[2] is a function call that occurs later than the rest which is why that get picked. I guess sl could be special cased to ignore setindex!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants