Skip to content

Tolerant parser: range of a member call on a parenthesised receiver starts after the '(' #505

Closed

Description

@blacktrs

The tolerant parser reports a source range for a member-access node that starts after the opening parenthesis of a parenthesised receiver, instead of at it.

Input (b.php):

<?php
(new Foo)->nope();

Command: bin/manticore dump-ast --tolerant --ranges b.php

Actual:

Program
  Stmt:Expression @2:1-2:19
    expr:
      Expr:MethodCall @2:2-2:18
        object:
          Expr:New @2:2-2:9

Expected: Expr:MethodCall @2:1-2:18 (the call starts at the ( in column 1, like the enclosing statement). The same likely applies to property access, ::, array access and calls on a parenthesised receiver; the range of the parenthesised expression should be extended to the parens, or the outer node should start at the ( token.

No Zend oracle (php has no ranges), so no tests/aot/repro file; it fits a tests/parser/cases golden once fixed. Found while building the LSP foundation (#456).

Activity

  1. added
    bug
    on Oct 27, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions