SUBTYPEP problem with hairy classes

Bug #310212 reported by Nikodemus Siivola on 2008-12-21
2
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

Reported by Lars Rune Nøstdal on sbcl-devel 2008-10-24.

SUBTYPEP sometimes signals an error when Contextl calls it to determine subclass relationships, causing the problems seen below (since Contextl assumes that SUBTYPEP signalling an error means NIL, basically.) The questions Contextl puts to SUBTYPEP seem answerable, and should not signal an error.

Test case below. To trigger the problem on a new Contextl replace SUBCLASSP tests in contextl with SUBTYPEP, SUBCLASSP there is a workaround for this SBCL bug.

        (eval-when (:compile-toplevel :load-toplevel :execute)
          (lfmakunbound 'name-of) ;; If I comment this out and eval the buffer or load the file twice, things work.
          (unintern 'person)
          (unintern 'address-mixin))

        (define-layered-class person ()
          ((name :accessor name-of
                 :initarg :name
                 :initform "name")))

        (deflayer address-mixin)
        (define-layered-class address-mixin :in address-mixin ()
          ((address :accessor address-of
                    :initarg :address
                    :initform "address")))

        (define-layered-class person :in address-mixin (address-mixin)
          ())

..backtrace:

        While computing the class precedence list of the class named PERSON.
        It is not possible to compute the class precedence list because
        there are circularities in the local precedence relations.
        These arise because:
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BEC9D81}> appears in the supers of the class named ADDRESS-MIXIN.
          The class named SPECIAL-OBJECT appears in the supers of the class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BEC9D81}>.
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED6241}> follows the class named SPECIAL-OBJECT in the
supers of the class named PERSON.
          The class named ADDRESS-MIXIN appears in the supers of the class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED6241}>.
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED1C41}> appears in the supers of the class named ADDRESS-MIXIN.
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BEC9D81}> follows the class
#<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED1C41}> in the supers of the class named ADDRESS-MIXIN..
           [Condition of type SIMPLE-ERROR]

        Restarts:
         0: [RETRY] Retry SLIME interactive evaluation request.
         1: [ABORT] Return to SLIME's top level.
         2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "worker" RUNNING {BE5BA61}>)

        Backtrace:
          0: (SB-PCL::CPL-ERROR #<LAYERED-CLASS PERSON> "It is not possible to compute the class precedence list
because~@\n there ~A in the local precedence relations.~@\n ~A because:~{~% ~A~}.")[:EX..
          1: (SB-PCL::COMPUTE-STD-CPL-PHASE-3 ..)
          2: (SB-PCL::MAKE-PRELIMINARY-LAYOUT #<LAYERED-CLASS PERSON>)
          3: (SB-PCL::MAKE-PRELIMINARY-LAYOUT #<LAYERED-CLASS PERSON>)[:EXTERNAL]
          4: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-PCL::.ARG1. SB-INT:&MORE
SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) ..)
          5: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE (SB-PCL::SLOT-OBJECT)) #<unavailable argument>
#<unavailable argument> #<LAYERED-CLASS PERSON>)[:EXTERNAL]
          6: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-INT:&MORE
SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) ..)
          7: ((FLET CALL-NEXT-METHOD))
          8: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (STANDARD-CLASS-IN-LAYER)) ..)[:EXTERNAL]
          9: ((FLET CALL-NEXT-METHOD))
         10: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (SPECIAL-CLASS)) ..)[:EXTERNAL]
         11: ((FLET CALL-NEXT-METHOD))
         12: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (LAYERED-ACCESS-CLASS)) ..)[:EXTERNAL]
         13: ((FLET CALL-NEXT-METHOD) ..)
         14: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (PARTIAL-CLASS)) ..)[:EXTERNAL]
         15: ((SB-PCL::FAST-METHOD SB-MOP:ENSURE-CLASS-USING-CLASS (SB-PCL::PCL-CLASS T)) #<unavailable
argument> #<unavailable argument> #<LAYERED-CLASS PERSON> PERSON)[:EXTERNAL]
         16: (SB-PCL::REAL-LOAD-DEFCLASS PERSON LAYERED-CLASS (ADDRESS-MIXIN) NIL (:IN-LAYER
ADDRESS-MIXIN) NIL NIL NIL #S(SB-C:DEFINITION-SOURCE-LOCATION :NAMESTRING NIL
:TOPLEVEL-FORM-NUMBER NIL :PLIST NIL) T)
         17: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-PCL::LOAD-DEFCLASS 'PERSON '

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers