Subject: bug#77494: 30.1; backward-up-list doesn't work as intended in php-ts-mode

From: Umar Ahmad <[email-masked]>
Date: Thu, 3 Apr 2025 21:02:12 +0530

backward-up-list stops at the start of php-doc string instead of going
further up the list to enclosing brackets when php-ts-mode is active

Replicating with emacs -Q
* emacs -Q
* (required once if not already done) M-x php-ts-mode-install-parsers
* M-x switch-to-buffer *temp*
* M-x php-ts-mode
* yank the following php snippet in the buffer
<?php
class Hello {
    /** @var string */
    private $name;
    /**
     * @return void
     */
    public function setName() :void {
        retur|n;
    }
}
* consider | as the point position (line:9)
* M-x backward-up-list
* point correctly moves to { after the function (line:8)
* M-x backward-up-list
* [Bug] point moves to / character (line:5)
* M-x backward-up-list
* [Bug] echo area logs "At top level"

Expectation was that the point would move to the {
on line 2 after the second backward-up-list command

 GNU Emacs 30.1 (build 2, aarch64-apple-darwin23.6.0, NS
 appkit-2487.70 Version 14.7.3 (Build 23H417)) of 2025-03-22 built on
 Umars-Macbook-Pro
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.7.5

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus@30/30.1/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus@30/30.1
 --with-native-compilation=aot --with-xml2 --with-gnutls
 --without-compress-install --without-dbus --without-imagemagick
 --with-modules --with-rsvg --with-webp --with-xwidgets --with-ns
 --disable-ns-self-contained 'CFLAGS=-O2 -DFD_SETSIZE=10000
 -DDARWIN_UNLIMITED_SELECT -I/opt/homebrew/opt/sqlite/include
 -I/opt/homebrew/opt/gcc/include -I/opt/homebrew/opt/libgccjit/include'
 'LDFLAGS=-L/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/lib/gcc/14
 -I/opt/homebrew/opt/gcc/include -I/opt/homebrew/opt/libgccjit/include''

Configured features:
ACL GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: PHP

Minor modes in effect:
  display-line-numbers-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message yank-media dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums display-line-numbers rx html-ts-mode
php-ts-mode comint ansi-osc ansi-color ring js cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs css-mode
smie sgml-mode facemenu imenu eww xdg url-queue thingatpt shr pixel-fill
kinsoku url-file svg xml dom browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util url-parse auth-source cl-seq eieio eieio-core
cl-macs icons password-cache json map byte-opt gv bytecomp byte-compile
url-vars mailcap puny mm-url gnus nnheader gnus-util
text-property-search time-date subr-x mail-utils range wid-edit mm-util
mail-prsvr color c-ts-common treesit cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads xwidget-internal kqueue cocoa ns lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 160600 10230) (symbols 48 13333 0) (strings 32 42165 3963)
 (string-bytes 1 1383167) (vectors 16 21407)
 (vector-slots 8 280373 8131) (floats 8 183 10) (intervals 56 329 0)
 (buffers 992 11))

-- 
Regards,
Umar Ahmad