mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
defmethod: make the function known at compile time.
(defmethod gf ()) (defun f () (gf)) Produced a warning about an undefined function, even though it would be implicitly created by defmethod. Fixes lp#503095.
This commit is contained in:
parent
5f89179381
commit
5728601f88
6
NEWS
6
NEWS
|
|
@ -1,4 +1,8 @@
|
||||||
;;;; -*- coding: utf-8; fill-column: 78 -*-
|
;;;; -*- coding: utf-8; fill-column: 78 -*-
|
||||||
|
changes relative to sbcl-1.1.13:
|
||||||
|
* enhancement: Top-level defmethod without defgeneric no longer causes
|
||||||
|
undefined-function warnings in subsequent forms. (lp#503095)
|
||||||
|
|
||||||
changes in sbcl-1.1.13 relative to sbcl-1.1.12:
|
changes in sbcl-1.1.13 relative to sbcl-1.1.12:
|
||||||
* optimization: better distribution of SXHASH over small conses of related
|
* optimization: better distribution of SXHASH over small conses of related
|
||||||
values. (lp#309443)
|
values. (lp#309443)
|
||||||
|
|
@ -21,7 +25,7 @@ changes in sbcl-1.1.13 relative to sbcl-1.1.12:
|
||||||
from the same location. (patch by Douglas Katzman, lp#1042405)
|
from the same location. (patch by Douglas Katzman, lp#1042405)
|
||||||
* bug fix: Create vectors of proper internal length when reading literal
|
* bug fix: Create vectors of proper internal length when reading literal
|
||||||
vectors from FASLs. (Reported by Jan Moringen)
|
vectors from FASLs. (Reported by Jan Moringen)
|
||||||
* bug fix: COMPILE can now succefully compile setf functions.
|
* bug fix: COMPILE can now successfully compile setf functions.
|
||||||
(Reported by Douglas Katzman)
|
(Reported by Douglas Katzman)
|
||||||
* bug fix: run-program performs more correct escaping of arguments on
|
* bug fix: run-program performs more correct escaping of arguments on
|
||||||
Windows. (lp#1239242)
|
Windows. (lp#1239242)
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,8 @@ bootstrapping.
|
||||||
(multiple-value-bind (qualifiers lambda-list body)
|
(multiple-value-bind (qualifiers lambda-list body)
|
||||||
(parse-defmethod args)
|
(parse-defmethod args)
|
||||||
`(progn
|
`(progn
|
||||||
|
(eval-when (:compile-toplevel :load-toplevel :execute)
|
||||||
|
(compile-or-load-defgeneric ',name))
|
||||||
;; KLUDGE: this double expansion is quite a monumental
|
;; KLUDGE: this double expansion is quite a monumental
|
||||||
;; workaround: it comes about because of a fantastic interaction
|
;; workaround: it comes about because of a fantastic interaction
|
||||||
;; between the processing rules of CLHS 3.2.3.1 and the
|
;; between the processing rules of CLHS 3.2.3.1 and the
|
||||||
|
|
|
||||||
5
tests/bug-503095-2.lisp
Normal file
5
tests/bug-503095-2.lisp
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
(defmethod gf503095-2 ()
|
||||||
|
(gf503095-2))
|
||||||
|
|
||||||
|
(defun f503095-2 ()
|
||||||
|
(gf503095-2))
|
||||||
5
tests/bug-503095.lisp
Normal file
5
tests/bug-503095.lisp
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
(defmethod gf503095 ()
|
||||||
|
(gf503095))
|
||||||
|
|
||||||
|
(defun f503095 ()
|
||||||
|
(gf503095))
|
||||||
|
|
@ -2101,5 +2101,22 @@
|
||||||
;; DEFMETHOD
|
;; DEFMETHOD
|
||||||
(sb-cltl2:macroexpand-all '(defmethod x (a) (macro))))
|
(sb-cltl2:macroexpand-all '(defmethod x (a) (macro))))
|
||||||
|
|
||||||
|
(with-test (:name (:defmethod-undefined-function :bug-503095))
|
||||||
|
(flet ((test-load (file)
|
||||||
|
(let (implicit-gf-warning)
|
||||||
|
(handler-bind
|
||||||
|
((sb-ext:implicit-generic-function-warning
|
||||||
|
(lambda (x)
|
||||||
|
(setf implicit-gf-warning x)
|
||||||
|
(muffle-warning x)))
|
||||||
|
((or warning error) #'error))
|
||||||
|
(load file))
|
||||||
|
(assert implicit-gf-warning))))
|
||||||
|
(multiple-value-bind (fasl warnings errorsp) (compile-file "bug-503095.lisp")
|
||||||
|
(unwind-protect
|
||||||
|
(progn (assert (and fasl (not warnings) (not errorsp)))
|
||||||
|
(test-load fasl))
|
||||||
|
(and fasl (delete-file fasl))))
|
||||||
|
(test-load "bug-503095-2.lisp")))
|
||||||
|
|
||||||
;;;; success
|
;;;; success
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue