Skip to content

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

Description

@mkitti

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions