diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index 5c5386dd829b723f16ade88b3ea975061008564a..8a5d92d85c4dd69df848ceb39ef27723c8b4120f 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -2041,11 +2041,7 @@ ((or cons eval:interpreted-function) `#',(get-lambda-to-compile definition)) (function - (multiple-value-bind (exp lexenv) - (function-lambda-expression definition) - (if (and exp (not lexenv)) - `#',exp - `',definition))))) + definition))) (*source-info* (make-lisp-source-info form)) (*top-level-lambdas* ()) (*converting-for-interpreter* nil) @@ -2069,6 +2065,14 @@ (*gensym-counter* 0) (*current-function-names* (list name)) (intl::*default-domain* intl::*default-domain*)) + ;; As mentioned above, we can return the same function if the + ;; function was already compiled. We do this when FORM is EQ + ;; to DEFINITION (which happens above if we have a compiled + ;; function that we don't have the source for or was defined + ;; in a non-null environment. + (when (and name (eq form definition)) + (return-from compile + (values name nil nil))) (with-debug-counters (clear-stuff) (find-source-paths form 0) diff --git a/tests/issues.lisp b/tests/issues.lisp index 26647dd265ff98812ea83ec93f5fea08a98b88af..5bf1fb0b7e28d5ba1b27ca440e643b9d078e2873 100644 --- a/tests/issues.lisp +++ b/tests/issues.lisp @@ -310,3 +310,8 @@ (assert-true (pathnamep fasl-file)) (assert-equalp (list fasl-file nil nil) (multiple-value-list (compile-file test-file :load t))))) + +(define-test issue.24 + (:tag :issues) + (let* ((test-file #.(merge-pathnames #p"resources/issue-24.lisp" cl:*load-pathname*))) + (assert-true (compile-file test-file :load t))))