GNU bug report logs -
#60659
30.0.50; tree-sitter: identical nodes are not `equal'
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60659 in the body.
You can then email your comments to 60659 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60659
; Package
emacs
.
(Sun, 08 Jan 2023 14:56:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mickey Petersen <mickey <at> masteringemacs.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 08 Jan 2023 14:56:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In order to check for node equality, one must use `treesit-node-eq'.
But I see little reason why two identical nodes in in the same tree aren't `equal'?
In GNU Emacs 30.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version
3.24.20, cairo version 1.16.0) of 2023-01-02 built on mickey-work
Repository revision: c209802f7b3721a1b95113290934a23fee88f678
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.3 LTS
Configured using:
'configure --with-native-compilation --with-json --with-mailutils
--without-compress-install --with-imagemagick CC=gcc-10'
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60659
; Package
emacs
.
(Mon, 09 Jan 2023 04:00:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 60659 <at> debbugs.gnu.org (full text, mbox):
Mickey Petersen <mickey <at> masteringemacs.org> writes:
> In order to check for node equality, one must use `treesit-node-eq'.
>
> But I see little reason why two identical nodes in in the same tree aren't `equal'?
Indeed. I’ll see if I can extend equal to handle tree-sitter nodes.
Yuan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60659
; Package
emacs
.
(Mon, 09 Jan 2023 08:57:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 60659 <at> debbugs.gnu.org (full text, mbox):
Yuan Fu <casouri <at> gmail.com> writes:
> Mickey Petersen <mickey <at> masteringemacs.org> writes:
>
>> In order to check for node equality, one must use `treesit-node-eq'.
>>
>> But I see little reason why two identical nodes in in the same tree aren't `equal'?
>
> Indeed. I’ll see if I can extend equal to handle tree-sitter nodes.
>
Nice one. This will allow for membership checks with `member' and
such-like and it'll greatly cut down on custom code, particularly one
you start writing tests!
> Yuan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60659
; Package
emacs
.
(Tue, 10 Jan 2023 05:57:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 60659 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Mickey Petersen <mickey <at> masteringemacs.org> writes:
> Yuan Fu <casouri <at> gmail.com> writes:
>
>> Mickey Petersen <mickey <at> masteringemacs.org> writes:
>>
>>> In order to check for node equality, one must use `treesit-node-eq'.
>>>
>>> But I see little reason why two identical nodes in in the same tree aren't `equal'?
>>
>> Indeed. I’ll see if I can extend equal to handle tree-sitter nodes.
>>
>
> Nice one. This will allow for membership checks with `member' and
> such-like and it'll greatly cut down on custom code, particularly one
> you start writing tests!
>
>> Yuan
Eli, does this look right to you? In particular, I’m not sure if it’s ok to call a lisp function (Ftreesit_node_eq) inside internal_equal, even though it never signals.
Yuan
[equal.diff (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60659
; Package
emacs
.
(Tue, 10 Jan 2023 13:12:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 60659 <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Mon, 9 Jan 2023 21:56:19 -0800
> Cc: 60659 <at> debbugs.gnu.org
>
> Eli, does this look right to you? In particular, I’m not sure if it’s ok to call a lisp function (Ftreesit_node_eq) inside internal_equal, even though it never signals.
It is better to make a C function from most of the body of
Ftreesit_node_eq, but without the CHECK_NODE parts, and make both
Fequal and Ftreesit_node_eq call that. Because CHECK_NODE can signal,
right? Also, you should make sure up front that _both_ o1 and o2 are
treesit nodes, otherwise they cannot be 'equal'.
Lars, Stefan: any comments/suggestions?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60659
; Package
emacs
.
(Wed, 11 Jan 2023 02:58:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 60659 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Mon, 9 Jan 2023 21:56:19 -0800
>> Cc: 60659 <at> debbugs.gnu.org
>>
>> Eli, does this look right to you? In particular, I’m not sure if
>> it’s ok to call a lisp function (Ftreesit_node_eq) inside
>> internal_equal, even though it never signals.
>
> It is better to make a C function from most of the body of
> Ftreesit_node_eq, but without the CHECK_NODE parts, and make both
> Fequal and Ftreesit_node_eq call that. Because CHECK_NODE can signal,
> right? Also, you should make sure up front that _both_ o1 and o2 are
> treesit nodes, otherwise they cannot be 'equal'.
I should’ve included some context. There is code that checks whether o1
and o2 have the same (pseudo vector) type and size[1], and returns early
if not, so I only need to check the type of o1. And since I checked the
type of o1, CHECK_NODE will always succeed.
But still, using a C functions is more correct. How about this?
[equal.diff (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]
Yuan
[1]
ptrdiff_t size = ASIZE (o1);
/* Pseudovectors have the type encoded in the size field, so this test
actually checks that the objects have the same type as well as the
same size. */
if (ASIZE (o2) != size)
return false;
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60659
; Package
emacs
.
(Wed, 11 Jan 2023 12:26:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 60659 <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Tue, 10 Jan 2023 18:57:02 -0800
> Cc: larsi <at> gnus.org,
> monnier <at> iro.umontreal.ca,
> 60659 <at> debbugs.gnu.org
>
> But still, using a C functions is more correct. How about this?
Yes, this is what I had in mind. Thanks.
Reply sent
to
Yuan Fu <casouri <at> gmail.com>
:
You have taken responsibility.
(Fri, 13 Jan 2023 01:09:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Mickey Petersen <mickey <at> masteringemacs.org>
:
bug acknowledged by developer.
(Fri, 13 Jan 2023 01:09:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 60659-done <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Tue, 10 Jan 2023 18:57:02 -0800
>> Cc: larsi <at> gnus.org,
>> monnier <at> iro.umontreal.ca,
>> 60659 <at> debbugs.gnu.org
>>
>> But still, using a C functions is more correct. How about this?
>
> Yes, this is what I had in mind. Thanks.
Cool. I applied it.
Yuan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 10 Feb 2023 12:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 73 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.