VALIDATE-SUPERCLASS: invalid error message when EQL-specializers are used

Bug #1809740 reported by Michał "phoe" Herda on 2018-12-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
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-LISP-USER::FOO>

CL-USER> (defmethod sb-mop:validate-superclass
           ((class class) (superclass (eql (find-class 'foo))))
           nil)
#<STANDARD-METHOD SB-MOP:VALIDATE-SUPERCLASS
  (CLASS (EQL #<STANDARD-CLASS COMMON-LISP-USER::FOO>)) {100341B4C3}>

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:VALIDATE-SUPERCLASS to avoid this
; 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.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers