From: Stas Boukarev Date: Thu, 15 Aug 2013 13:43:13 +0000 (+0400) Subject: Throw errors on malformed FUNCTION. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=9e7a18990d8cfe726edca3450f84510f5676a3e1;p=sbcl.git Throw errors on malformed FUNCTION. (funcall (function X junk)) didn't throw an error in the presence of a compiler-macro for X. Patch by Douglas Katzman. --- diff --git a/NEWS b/NEWS index 912f5b9..9a8a4e9 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ changes relative to sbcl-1.1.10 (lp#1189146) * bug fix: undefined function errors are now properly reported on PPC and MIPS. (regression since 1.1.9) + * bug fix: (funcall (function X junk)) didn't causes an error when X had a + compiler macro. + Patch by Douglas Katzman. changes in sbcl-1.1.10 relative to sbcl-1.1.9: * enhancement: ASDF has been updated to 3.0.2. diff --git a/src/compiler/ir1tran.lisp b/src/compiler/ir1tran.lisp index b05f9c3..b2bd2e7 100644 --- a/src/compiler/ir1tran.lisp +++ b/src/compiler/ir1tran.lisp @@ -700,7 +700,8 @@ (defun find-compiler-macro (opname form) (if (eq opname 'funcall) (let ((fun-form (cadr form))) - (cond ((and (consp fun-form) (eq 'function (car fun-form))) + (cond ((and (consp fun-form) (eq 'function (car fun-form)) + (not (cddr fun-form))) (let ((real-fun (cadr fun-form))) (if (legal-fun-name-p real-fun) (values (sb!xc:compiler-macro-function real-fun *lexenv*) diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index fe4f6c3..a11df47 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -1409,6 +1409,18 @@ (compile nil `(lambda (x) (cmacro-with-tricky-key x 42))) (assert (and (not warn) (not fail))) (assert (string= "fun=42" (funcall fun 'tricky-key))))) + +(defun test-function-983 (x) x) +(define-compiler-macro test-function-983 (x) x) + +(with-test (:name funcall-compiler-macro) + (assert + (handler-case + (compile nil + `(lambda () + (funcall (function test-function-983 junk) 1))) + (sb-c:compiler-error () t) + (:no-error () nil)))) ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself