From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#40968: 28.0.50; (apply nil) Date: Thu, 07 May 2020 07:54:10 -0400 Message-ID: <874kssm04d.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="60446"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Cc: Stefan Kangas , 40968@debbugs.gnu.org, Pip Cet To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 07 13:55:08 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jWf7M-000Fcq-KW for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 May 2020 13:55:08 +0200 Original-Received: from localhost ([::1]:33104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWf7L-0005Vj-JC for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 May 2020 07:55:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWf7G-0005Vc-Di for bug-gnu-emacs@gnu.org; Thu, 07 May 2020 07:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jWf7G-0006SC-4m for bug-gnu-emacs@gnu.org; Thu, 07 May 2020 07:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jWf7G-0004cF-2d for bug-gnu-emacs@gnu.org; Thu, 07 May 2020 07:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 May 2020 11:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40968 X-GNU-PR-Package: emacs Original-Received: via spool by 40968-submit@debbugs.gnu.org id=B40968.158885247217662 (code B ref 40968); Thu, 07 May 2020 11:55:02 +0000 Original-Received: (at 40968) by debbugs.gnu.org; 7 May 2020 11:54:32 +0000 Original-Received: from localhost ([127.0.0.1]:42296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jWf6m-0004al-7n for submit@debbugs.gnu.org; Thu, 07 May 2020 07:54:32 -0400 Original-Received: from mail-qt1-f180.google.com ([209.85.160.180]:36996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jWf6l-0004aY-5O for 40968@debbugs.gnu.org; Thu, 07 May 2020 07:54:31 -0400 Original-Received: by mail-qt1-f180.google.com with SMTP id k12so55739qtm.4 for <40968@debbugs.gnu.org>; Thu, 07 May 2020 04:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=+k6EryN+j1Lc2Nrx02ytCvSG5I3SJV6/Le9Pm9N3UZY=; b=kiXY6kwMkB8V3g7qqN1J3vb/LMAn5G3VysgtuWLcCo/ocuycAuSuQWWjFvWbLG6dAJ E8i5qcIFtLeCMDGdzPwslkBd+pKScspmo1/x0tJ203qSZSpPV5a8bAHvt3biaz7XZKt9 TYSDf7+ZooEVMAUVjKrOA+kBO6lOUeGftOpnQ9UMzCcGtsfPlo3WYwUv4V3g4F/crSy2 NvoMc9WVbfz2HiA5pEnMQHSMhHx/4+fJEzoupEkU7++UKkLCcaS8S3o8RkGKNgYIuqbV taXvKzYCJe4blKV/X9jcIXqyF7XfjkIfWS3tRbI6lq/hbGL9HJ3HCMGDD659M0nrNbtG Thow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=+k6EryN+j1Lc2Nrx02ytCvSG5I3SJV6/Le9Pm9N3UZY=; b=f5Bqv4s/RPLcA00/XLbg8qi94dGqhfMJra4lCC7ErYcTGLMplHegx/C4evs308okr5 bRpjeFidNLS+bVgGPQMgpyTdvzMJbKZglllO52/19VRvuKcsoNT2jfY2gEjdlY7F+a06 +3TJBoiCOPMiTlbkOR8Un6qbPpoxssIWoISFWWFWgyDv0tLgA1ZROXM2hFhKp3ozfZ6f DiLeXOemx/qyN1y41w+lHj7aauPAYzOyqGeGqLmDw7r2Hq2LM+RpAQwje3eXF0U8a0Nz nMYIx1cyVLR0Oc0fcZlotBjJSIeENgOlx0iNTRoDC7k5PIWnMnzs1mP/Y96UZkdiA72N GS7Q== X-Gm-Message-State: AGi0PuZqdkxqSqr5LtGslo35NKUFc1n3ubcdVOEAj+l1zL1szZlYYpSx D06J3HaN6jT+zSERiXt7ypDwtUAd X-Google-Smtp-Source: APiQypJpQCJm72GCQ3Z8appqm/pMMSHV+E0v7xL/P7NAheT90yz7aDWssp/1SSl1ll2jdDRAPD3tJQ== X-Received: by 2002:ac8:19fd:: with SMTP id s58mr14027118qtk.354.1588852465195; Thu, 07 May 2020 04:54:25 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-47.yyz.frontiernetworks.ca. [45.2.119.47]) by smtp.gmail.com with ESMTPSA id v4sm3973247qkv.43.2020.05.07.04.54.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 May 2020 04:54:24 -0700 (PDT) In-Reply-To: ("Mattias =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Thu, 7 May 2020 11:11:00 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179875 Archived-At: Mattias Engdeg=C3=A5rd writes: > 7 maj 2020 kl. 08.53 skrev Pip Cet : > >> It is incomplete. However, I've yet to find an elegant way to fix the >> byte compiler and get it to emit the right error message. Can you >> think of one? > > You are right, that's a puzzle. No, I cannot think of an elegant way > (but a few inelegant ones). The obvious solution is just to leave the weird single arg form unoptimized. Otherwise, what about your earlier suggestion? (apply X) =3D=3D (apply (car X) (cdr X)) > It's probably not worth the trouble; just change the error test case By the way, bytecomp-check-1 already ignores differences between error types. So the test case doesn't need a condition-case at all if we don't care about which particular error is signalled. --- i/lisp/emacs-lisp/byte-opt.el +++ w/lisp/emacs-lisp/byte-opt.el @@ -1100,7 +1100,7 @@ byte-optimize-apply ;; The funcall optimizer can then transform (funcall 'foo ...) -> (foo .= ..). (if (=3D (length form) 2) ;; single-argument `apply' is special (bug#40968) - (byte-optimize-apply `(apply #'funcall ,(cadr form))) + (byte-optimize-apply `(apply (car ,(cadr form)) (cdr ,(cadr form)))) (let ((fn (nth 1 form)) (last (nth (1- (length form)) form))) ; I think this really is fastest (or (if (or (null last) diff --git i/src/eval.c w/src/eval.c index 77f54ad7b1..836be7a906 100644 --- i/src/eval.c +++ w/src/eval.c @@ -2373,10 +2373,11 @@ DEFUN ("apply", Fapply, Sapply, 1, MANY, 0, Lisp_Object fun =3D args[0]; USE_SAFE_ALLOCA; =20 - ptrdiff_t numargs =3D list_length (spread_arg); + if (nargs =3D=3D 1) + /* Special case: FUN is really a list of (FUNCTION . ARGS). */ + return CALLN (Fapply, CAR (fun), CDR (fun)); =20 - if (numargs =3D=3D 0 && nargs =3D=3D 1) - wrong_type_argument (Qconsp, spread_arg); + ptrdiff_t numargs =3D list_length (spread_arg); =20 if (numargs =3D=3D 0) return Ffuncall (nargs - 1, args);