From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel 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 Message-ID: References: <20210306221735.5128.9787@vcs0.savannah.gnu.org> <20210306221736.5E86020A10@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18351"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org, Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 07 07:56:42 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lInLG-0004gC-In for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Mar 2021 07:56:42 +0100 Original-Received: from localhost ([::1]:35342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lInLF-00029f-L7 for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Mar 2021 01:56:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lInKY-0001aW-OI for emacs-devel@gnu.org; Sun, 07 Mar 2021 01:55:58 -0500 Original-Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]:42595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lInKT-0000GW-HI for emacs-devel@gnu.org; Sun, 07 Mar 2021 01:55:58 -0500 Original-Received: by mail-ot1-x329.google.com with SMTP id e45so6102893ote.9 for ; Sat, 06 Mar 2021 22:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=B7JzHRb9qp2hrF4qo3tWaPAQXIT9Owf7qLDbjZBJqjM=; b=XuGjm3hM81mOFP8bedIQ0IyMV0DTBsDW/8cert1rI6DaJXMpWmmLMF6xkujX7Hyluv TPMzlTGqszBGSt/1A6YrCRyLXchcFi9HStMhdtLxYamHMLTlv7yMJDabhTD93gpENcmT 8uOjbA6U/Ywbh172JbiND2hO4y88Zo5+sQ1OTE7c9kg0KgbHDWxRuIMy2taDhlBodZkd 2lWQWrPfde+lHEZAYrYD5a98wOA1X++pCz4YYrlxKvRiYQ8Xmm9ATEcpUtXtO311a+eV 3erucIiyCzNkIUnYyBS8tv1Na+Kb7bSGMaNl9T+zPens+MO+BxmZ3CSU7hj07Txim3x6 XeUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=B7JzHRb9qp2hrF4qo3tWaPAQXIT9Owf7qLDbjZBJqjM=; b=sGSlGgHEyxQof4BpdHzf3BhzlBm7XilpEkU7bhOE2uT9f2ZALGFPnLnuBqn8OzpEi0 SGmnQkMSz/9Moxndvho1seD6FtWJtRYjOeeDvlCNWGx1sSfcKbyjw8puJkRWpMUn6EOS 1e0SiBp0dK1QLUF2gVDO8vg4EahCDNx9IFj5IeAmQj20OAUvIKipCWI9kFVYQH3G8fH5 PVyw3Fi4HqXddHdynFCivnifXaieNZl0EUL3uJpAqeUj0XPL2ndXI1YURY0d4WNIWlc6 K5JH+pIvN4FDMa32M3wUMLu1QaXSZnDaPQVnzybl4ancveOmENElrqbOH1KChsv8quBb 72Nw== X-Gm-Message-State: AOAM532/DO5iGm8i5X4xCh3Znq4dq/c31fEP9/UZJzerrhyaAXyIOL17 NwovvbYk71bEx/xnndBLqBMielIBypYsOrMpmbLLL3UcUg99qg== X-Google-Smtp-Source: ABdhPJxAxZmOWUtbRUwU3CHuaZp3Zv4LK1ojvf5Gtp6KDAI73vUf89iDrOWLAlT5Fpp+xdXNUnDgu5wCClwv8HmFROM= X-Received: by 2002:a05:6830:1011:: with SMTP id a17mr12754895otp.154.1615100152426; Sat, 06 Mar 2021 22:55:52 -0800 (PST) In-Reply-To: <20210306221736.5E86020A10@vcs0.savannah.gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=pipcet@gmail.com; helo=mail-ot1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:266112 Archived-At: On Sat, Mar 6, 2021 at 10:17 PM Andrea Corallo wrote: > branch: feature/native-comp > commit c60f2f458a63a8ae4288652228f24e43fdc7bba7 > Author: Andrea Corallo > Commit: Andrea Corallo > > 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