From 99f12b8ef75252c8d2d52705b53f2a8f9227443a Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Sat, 18 Oct 2008 10:27:58 +0000 Subject: [PATCH] 1.0.21.27: no more &OPTIONAL-DISPATCH debug names * IR1-CONVERT-HAIRY-LAMBDA used to give optional dispatch entry points `(&OPTIONAL-DISPATCH ,(OR )) as debug-name. Don't do that -- just use the provided DEBUG-NAME directly (it's NIL in the cases we most care about, leaving the functional with just a source-name). This fixes two issues: 1. Functions with non-required arguments didn't get the derived type information saved in the infodb. FINALIZE-XEP-DEFINITION didn't set the INFO entries properly because (eq (leaf-source-name leaf) (functional-debug-name leaf)) was false -- it's true only if there is no separate debug-name. 2. Functions with non-required arguments printed as # because non-NIL debug-name is preferred over the source-name. * Test-cases. --- NEWS | 4 ++++ src/compiler/ir1tran-lambda.lisp | 3 +-- tests/compiler.impure.lisp | 11 +++++++++++ tests/compiler.pure.lisp | 6 ++++++ version.lisp-expr | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 918e282..14b6595 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,10 @@ changes in sbcl-1.0.22 relative to 1.0.21: * bug fix: COMPILE-FILE did not warn about undefined variable references at toplevel, and LOAD of the resulting fasl did not signal an error. + * bug fix: functions with non-required arguments used to end up with + (SB-C::&OPTIONAL-DISPATCH ...) as their name. + * bug fix: redefining a function with non-required arguments didn't + update the system's knowledge about its call signature properly. changes in sbcl-1.0.21 relative to 1.0.20: * new feature: the compiler is able to track the effective type of a diff --git a/src/compiler/ir1tran-lambda.lisp b/src/compiler/ir1tran-lambda.lisp index ee321c0..f157019 100644 --- a/src/compiler/ir1tran-lambda.lisp +++ b/src/compiler/ir1tran-lambda.lisp @@ -868,8 +868,7 @@ :allowp allowp :keyp keyp :%source-name source-name - :%debug-name (debug-name '&optional-dispatch - (or debug-name source-name)) + :%debug-name debug-name :plist `(:ir1-environment (,*lexenv* ,*current-path*)))) diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index dad96e8..6c8ed83 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -942,6 +942,17 @@ (with-test (:name :complex-call-doesnt-warn) (handler-bind ((warning #'error)) (compile nil '(lambda (x) (complex-function-signature x :z1 1 :z2 2))))) + +(with-test (:name :non-required-args-update-info) + (let ((name (gensym "NON-REQUIRE-ARGS-TEST")) + (*evaluator-mode* :compile)) + (eval `(defun ,name (x) x)) + (assert (equal '(function (t) (values t &optional)) + (sb-kernel:type-specifier (sb-int:info :function :type name)))) + (eval `(defun ,name (x &optional y) (or x y))) + (assert (equal '(function (t &optional t) (values t &optional)) + (sb-kernel:type-specifier (sb-int:info :function :type name)))))) + ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 0623c1f..6f48dad 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -2645,3 +2645,9 @@ (destructuring-bind (a (b c) d) '(1 "foo" 4) (+ a b c d))))) :feh)))))) + +;;; Functions with non-required arguments used to end up with +;;; (&OPTIONAL-DISPATCH ...) as their names. +(with-test (:name :hairy-function-name) + (assert (eq 'read-line (nth-value 2 (function-lambda-expression #'read-line)))) + (assert (equal "#" (princ-to-string #'read-line)))) diff --git a/version.lisp-expr b/version.lisp-expr index c129002..7434eb8 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.21.26" +"1.0.21.27" -- 1.7.10.4