Skip to content

caller appears to report wrong line when block passed and brackets omitted #5949

Closed

Description

@jabamaus

Dear mruby developers,

I've recently started working with mruby and am busy porting my codebase from cruby to mruby in such a way that the code executes the same. Its been throwing up a lot of issues (mostly due to occasional missing methods), which I am managing to get past. However, some of my tests are failing due to the following issue. The following code demonstrates the problem. I heavily use the second form (without the function call brackets) so this issue is important to me. I also heavily rely on Kernel#caller. This issue only shows up if a block is passed aswell as not using brackets. Is this a bug? It definitely behaves different to cruby which does what I expect.

Thanks for mruby!

def a(id) = puts caller[0]

a(1) do # caller reports this line
end

a 1 do
end # without brackets caller reports this line

Activity

  1. jabamaus commented on Mar 9, 2023

    @jabamaus
    Author

    I should say I'm using mruby 3.2 on windows.

  2. jabamaus commented on Mar 11, 2023

    @jabamaus
    Author

    Thank you so much Matz. Really appreciate it :)

  3. added a commit that references this issue on Feb 7, 2024
    7f79ca2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions