Skip to content

Commit

Permalink
fix some more of the ancient define-method-combination bugs
Browse files Browse the repository at this point in the history
MORE PROGRAM ERRORS
  • Loading branch information
csrhodes committed May 10, 2018
1 parent 0cca24d commit 7c61bbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pcl/defcombin.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,20 @@
(defun expand-long-defcombin (form)
(let ((type-name (cadr form))
(lambda-list (caddr form))
(method-group-specifiers-presentp (cdddr form))
(method-group-specifiers (cadddr form))
(body (cddddr form))
(args-option ())
(gf-var nil))
(unless method-group-specifiers-presentp
(%program-error "~@<The long form of ~S requires a list of method group specifiers.~:>"
'define-method-combination))
(when (and (consp (car body)) (eq (caar body) :arguments))
(setq args-option (cdr (pop body))))
(when (and (consp (car body)) (eq (caar body) :generic-function))
(unless (and (cdar body) (symbolp (cadar body)) (null (cddar body)))
(%program-error "~@<The argument to the ~S option of ~S must be a single symbol.~:>"
:generic-function 'define-method-combination))
(setq gf-var (cadr (pop body))))
(multiple-value-bind (documentation function)
(make-long-method-combination-function
Expand Down
15 changes: 15 additions & 0 deletions tests/clos-1.impure.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,18 @@
(with-test (:name :bug-309084-a-ii)
(assert-error (eval '(define-method-combination bug-309084-a-ii :documentation nil))
program-error))
(with-test (:name :bug-309084-a-iii)
(assert-error (eval '(define-method-combination bug-309084-a-iii nil))
program-error))
(with-test (:name :bug-309084-a-vi)
(assert-error (eval '(define-method-combination bug-309084-a-vi nil nil
(:generic-function)))
program-error))
(with-test (:name :bug-309084-a-vii)
(assert-error (eval '(define-method-combination bug-309084-a-vii nil nil
(:generic-function bar baz)))
program-error))
(with-test (:name :bug-309084-a-viii)
(assert-error (eval '(define-method-combination bug-309084-a-viii nil nil
(:generic-function (bar))))
program-error))

0 comments on commit 7c61bbe

Please sign in to comment.