From 31483b89d1d48d6811bf632ea433003864c3a7f5 Mon Sep 17 00:00:00 2001 From: Jan Moringen Date: Mon, 14 Aug 2017 23:08:51 +0200 Subject: [PATCH] Better errors for inappropriate dotted lists in forms This applies to special forms and calls. E.g. (let () . 1) (cons 1 . 2) ((lambda (x) x) . 1) --- NEWS | 2 ++ src/compiler/ir1tran.lisp | 2 ++ tests/compiler.pure.lisp | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/NEWS b/NEWS index c3bc66c2e..603aba59e 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ changes relative to sbcl-1.3.20: * optimization: optimized external-format routines. * bug fix: SB-INTROSPECT:ALLOCATION-INFORMATION returns :IMMOBILE instead of :FOREIGN for objects in immobile space. + * bug fix: dotted lists in special forms and function call forms signal + an appropriate error changes in sbcl-1.3.20 relative to sbcl-1.3.19: * minor incompatible change: DEF{GENERIC,METHOD} no longer accept some diff --git a/src/compiler/ir1tran.lisp b/src/compiler/ir1tran.lisp index 5128f82a5..a78397e81 100644 --- a/src/compiler/ir1tran.lisp +++ b/src/compiler/ir1tran.lisp @@ -598,6 +598,8 @@ (reference-leaf start next result form)) (t (reference-constant start next result form)))) + ((not (proper-list-p form)) + (compiler-error "~@<~S is not a proper list.~@:>" form)) (t (ir1-convert-functoid start next result form))))) (values)) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 9d3fb0e1d..0a03c68d5 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -6520,3 +6520,18 @@ (scale-float p1 27))) 1.0) 1.3421773e8))) + +(with-test (:name (compile :call :dotted-list)) + (flet ((test (form) + (multiple-value-bind (fun failure-p warnings style-warnings notes + compiler-errors) + (checked-compile `(lambda () ,form) + :allow-failure t :allow-warnings t) + (declare (ignore fun warnings style-warnings notes)) + (assert failure-p) + (assert (= 1 (length compiler-errors))) + (assert (search "is not a proper list." + (princ-to-string (first compiler-errors))))))) + (test '(cons 1 . 2)) + (test '((lambda (x) x) . 1)) + (test '(let () . 1)))) -- 2.11.4.GIT