VALIDATE-SUPERCLASS: invalid error message when EQL-specializers are used
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Let's create a class named FOO and explicitly prevent it from being subclassed via a method on VALIDATE-SUPERCLASS with an EQL-specializer.
CL-USER> (defclass foo () ())
#<STANDARD-CLASS COMMON-
CL-USER> (defmethod sb-mop:
((class class) (superclass (eql (find-class 'foo))))
nil)
#<STANDARD-METHOD SB-MOP:
(CLASS (EQL #<STANDARD-CLASS COMMON-
CL-USER> (defclass bar (foo) ())
; Error: The class #<STANDARD-CLASS FOO> was specified as a superclass of the
; class #<STANDARD-CLASS BAR {100371D223}>, but the metaclasses
; #<STANDARD-CLASS STANDARD-CLASS> and #<STANDARD-CLASS STANDARD-CLASS> are
; incompatible. Define a method for SB-MOP:
; error.
The error message suggests that STANDARD-CLASS is incompatible with itself, which is false in this specific case.
Sure, the case when most people want to define their own methods on VALIDATE-SUPERCLASS is when they attempt to define their own metaclasses, and that is when the error message is helpful, but VALIDATE-SUPERCLASS is a more generic function than "are these metaclasses compatible". The error message should take it into account.
This bugticket is invalid, because the following form:
CL-USER> (defmethod sb-mop: validate- superclass
((class class) (superclass (eql (find-class 'foo))))
nil)
runs afoul of CLHS 11.1.2.1.2 point 19 if FOO is a STANDARD-CLASS (which it is in this case).