Skip to content

[Bug] Call location doesn't include closing ) if there's a block pass argument #3708

Closed

Description

@amomchilov
 foo(&nil)
#        ^ closing_loc
#^^^^^^^^  Incorrect CallNode loc
#^^^^^^^^^ Correct CallNode loc
Prism.parse "foo(&nil)"
=>
# ...
@ CallNode (location: (1,0)-(1,8)) # ❌
├── flags: newline, ignore_visibility
├── receiver: ∅
├── call_operator_loc: ∅
├── name: :foo
├── message_loc: (1,0)-(1,3) = "foo"
├── opening_loc: (1,3)-(1,4) = "("
├── arguments: ∅
├── closing_loc: (1,8)-(1,9) = ")" # ℹ️
└── block:
    @ BlockArgumentNode (location: (1,4)-(1,8))
    ├── flags: ∅
    ├── expression:
    │   @ NilNode (location: (1,5)-(1,8))
    │   └── flags: static_literal
    └── operator_loc: (1,4)-(1,5) = "&"

Just documenting this for now. I'll take a stab at fixing it in the near future.

Activity

  1. changed the title [-]Bug: method location doesn't include closing `)` if there's a block pass argument[/-] [+][Bug] Call location doesn't include closing `)` if there's a block pass argument[/+] on Nov 6, 2025
  2. Earlopain commented on Nov 12, 2025

    @Earlopain
    Collaborator

    It looks correct to me on current main. I don't remember any changes to this recently, but do you perhaps vendor an older version of prism?

  3. Earlopain commented on Nov 12, 2025

    @Earlopain
    Collaborator

    Ah, I guess it was fixed in #3634, prism 1.5.0

  4. amomchilov commented on Nov 12, 2025

    @amomchilov
    ContributorAuthor

    Ah apologies, I was using Prism 1.4.0.

    I know "user reports bug on old version" is a common issue. Sorry for contributing to it D:

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