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

Debugger appears to step into an if statement even if the condition is false. #342

Open
mkitti opened this issue Feb 11, 2024 · 1 comment

Comments

@mkitti
Copy link

mkitti commented Feb 11, 2024

The debugger appears to step into an if statement if no other statements follow it. Below the debugger goes from line 2 then proceeds to line 4 within the if statement before returning.

julia> using Debugger

julia> struct Circle end

julia> function test_circle(circle::Circle)
           if typeof(circle) == "Circle"
               println("Thou shall not pass!")
               println("Hello world!")
           end
       end
test_circle (generic function with 1 method)

julia> @enter test_circle(Circle())
In test_circle(circle) at REPL[10]:1
 1  function test_circle(circle::Circle)
>2      if typeof(circle) == "Circle"
 3          println("Thou shall not pass!")
 4          println("Hello world!")
 5      end
 6  end

About to run: (typeof)(Circle())
1|debug> n
In test_circle(circle) at REPL[10]:1
 1  function test_circle(circle::Circle)
 2      if typeof(circle) == "Circle"
 3          println("Thou shall not pass!")
>4          println("Hello world!")
 5      end
 6  end

About to run: return
1|debug> n

If I add a return statement, then the stepping appears correct. It advances from line 2 to line 6.

julia> function test_circle(circle::Circle)
           if typeof(circle) == "Circle"
               println("Thou shall not pass!")
               println("Hello world!")
           end
           return nothing
       end
test_circle (generic function with 1 method)

julia> @enter test_circle(Circle())
In test_circle(circle) at REPL[12]:1
 1  function test_circle(circle::Circle)
>2      if typeof(circle) == "Circle"
 3          println("Thou shall not pass!")
 4          println("Hello world!")
 5      end
 6      return nothing
 7  end

About to run: (typeof)(Circle())
1|debug> n
In test_circle(circle) at REPL[12]:1
 2      if typeof(circle) == "Circle"
 3          println("Thou shall not pass!")
 4          println("Hello world!")
 5      end
>6      return nothing
 7  end

About to run: return
1|debug> n
@pfitzseb
Copy link
Member

Ref julia-vscode/julia-vscode#2693.

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