From: Pip Cet <pipcet@gmail.com>
To: emacs-devel@gnu.org, Andrea Corallo <akrl@sdf.org>
Subject: Re: feature/native-comp c60f2f4: Fix `comp-cstr-intersection-no-hashcons' for negated result cstr
Date: Sun, 7 Mar 2021 06:55:16 +0000 [thread overview]
Message-ID: <CAOqdjBeps0NSddbEDRHL=0gyDXR=ABE63b7zWKCZvOQn1mjYVQ@mail.gmail.com> (raw)
In-Reply-To: <20210306221736.5E86020A10@vcs0.savannah.gnu.org>
On Sat, Mar 6, 2021 at 10:17 PM Andrea Corallo <akrl@savannah.gnu.org> wrote:
> branch: feature/native-comp
> commit c60f2f458a63a8ae4288652228f24e43fdc7bba7
> Author: Andrea Corallo <akrl@sdf.org>
> Commit: Andrea Corallo <akrl@sdf.org>
>
> Fix `comp-cstr-intersection-no-hashcons' for negated result cstr
>
> * lisp/emacs-lisp/comp-cstr.el
> (comp-cstr-intersection-no-hashcons): When negated and
> necessary relax dst to t.
> * test/src/comp-tests.el (comp-tests-type-spec-tests): Add a test.
> ---
> lisp/emacs-lisp/comp-cstr.el | 32 +++++++++++++++++++-------------
> test/src/comp-tests.el | 9 ++++++++-
> 2 files changed, 27 insertions(+), 14 deletions(-)
>
> diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
> index d6423ef..4397a91 100644
> --- a/lisp/emacs-lisp/comp-cstr.el
> +++ b/lisp/emacs-lisp/comp-cstr.el
> @@ -1001,20 +1001,26 @@ promoted to their types.
> DST is returned."
> (with-comp-cstr-accessors
> (apply #'comp-cstr-intersection dst srcs)
I still think this code is incorrect, because it does an eq/eql-based
intersection first and tries to relax the constraint later. Consider
(let ((comp-ctxt (make-comp-cstr-ctxt)))
(comp-cstr-intersection-no-hashcons
(make-comp-cstr)
(comp-value-to-cstr '(a))
(comp-value-to-cstr '(a))))
That should return a constraint matching all (or many) conses, right?
It returns an empty constraint.
(let* ((cons1 '(a))
(cons2 (copy-sequence cons1))
(cons3 (copy-sequence cons1)))
(funcall (native-compile
`(lambda (x y)
(if (equal x '(a))
(setq x ',cons1))
(if (equal y '(a))
(setq y ',cons2))
(unless (or (eq x ',cons1)
(eq x 'a))
(error "x is %S" x))
(unless (eq y ',cons2)
(error "2"))
(if (equal x y) x)))
'(a) '(a)))
Should return (a), but returns nil.
Pip
next parent reply other threads:[~2021-03-07 6:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210306221735.5128.9787@vcs0.savannah.gnu.org>
[not found] ` <20210306221736.5E86020A10@vcs0.savannah.gnu.org>
2021-03-07 6:55 ` Pip Cet [this message]
2021-03-07 7:04 ` feature/native-comp c60f2f4: Fix `comp-cstr-intersection-no-hashcons' for negated result cstr Andrea Corallo via Emacs development discussions.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOqdjBeps0NSddbEDRHL=0gyDXR=ABE63b7zWKCZvOQn1mjYVQ@mail.gmail.com' \
--to=pipcet@gmail.com \
--cc=akrl@sdf.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).