#628 The argument is not of type CLOS::DEFINED-CLASS: NIL

lisp error
closed-fixed
clisp (525)
5
2012-02-13
2012-02-13
No

The following fails on clisp-2.49:

(defgeneric foo (object)
(:method ((x list)) (declare (ignore x)))
(:method ((x array)) (declare (ignore x)))
(:method ((x sequence)) (declare (ignore x))))

(foo '(1 2 3))

=> *** - CLOS::CLASS-INITIALIZED: The argument is not of type
CLOS::DEFINED-CLASS: NIL

Discussion

  • Sam Steingold

    Sam Steingold - 2012-02-13

    backtrace;

    <11/120> #<SYSTEM-FUNCTION SYSTEM::ERROR-OF-TYPE>
    <12/110> #<COMPILED-FUNCTION CLOS::ERROR-ACCESSOR-TYPECHECK>
    <13/106> #<COMPILED-FUNCTION CLOS::CLASS-INITIALIZED>
    <14/104> #<COMPILED-FUNCTION CLOS::SUBCLASSP>
    <15/101> #<COMPILED-FUNCTION CLOS::BC-AND>
    <16/93> #<COMPILED-FUNCTION CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE>
    <17/85> #<COMPILED-FUNCTION CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE>
    <18/77> #<COMPILED-FUNCTION CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE>
    <19/70> #<COMPILED-FUNCTION CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE>
    <20/60> #<COMPILED-FUNCTION CLOS::COMPUTE-DISPATCH-RECURSION>
    <21/48> #<COMPILED-FUNCTION CLOS::COMPUTE-DISPATCH>
    <22/46> #<COMPILED-FUNCTION CLOS::COMPUTE-DISCRIMINATING-FUNCTION-<GENERIC-FUNCTION>>
    <23/44> #<COMPILED-FUNCTION #:|201 203 (DEFGENERIC COMPUTE-DISCRIMINATING-FUNCTION (GF) ...)-19-1|>
    <24/44> #<STANDARD-GENERIC-FUNCTION COMPUTE-DISCRIMINATING-FUNCTION>
    <25/41> #<COMPILED-FUNCTION CLOS::INSTALL-DISPATCH>
    <26/39> #<COMPILED-FUNCTION CLOS::INITIAL-FUNCALL-GF>
    <27/36> #<STANDARD-GENERIC-FUNCTION FOO>
    [34] EVAL frame for form (FOO '(1 2 3))

     
  • Sam Steingold

    Sam Steingold - 2012-02-13
    • labels: --> clisp
    • milestone: --> 100333
    • assigned_to: nobody --> haible
     
  • Bruno Haible

    Bruno Haible - 2012-02-13

    The chain of invocations is the following:

    (foo '(1 2 3))

    (CLOS::INITIAL-FUNCALL-GF #<STANDARD-GENERIC-FUNCTION FOO>)

    (CLOS::INSTALL-DISPATCH #<STANDARD-GENERIC-FUNCTION FOO>)

    (COMPUTE-DISCRIMINATING-FUNCTION #<STANDARD-GENERIC-FUNCTION FOO>)

    (CLOS::COMPUTE-DISCRIMINATING-FUNCTION-<GENERIC-FUNCTION> #<STANDARD-GENERIC-FUNCTION FOO>)

    (CLOS::COMPUTE-DISPATCH #<STANDARD-GENERIC-FUNCTION FOO>)

    (CLOS::COMPUTE-DISPATCH-RECURSION '(0)
    '(#<STANDARD-METHOD (#<BUILT-IN-CLASS SEQUENCE>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS ARRAY>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS LIST>)>)
    NIL)

    (CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE #<BUILT-IN-CLASS T>
    '(#<BUILT-IN-CLASS SEQUENCE> #<BUILT-IN-CLASS ARRAY> #<BUILT-IN-CLASS LIST>)
    '(#<STANDARD-METHOD (#<BUILT-IN-CLASS SEQUENCE>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS ARRAY>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS LIST>)>))

    (CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE #<BUILT-IN-CLASS SEQUENCE>
    '(#<BUILT-IN-CLASS VECTOR> #<BUILT-IN-CLASS LIST>)
    '(#<STANDARD-METHOD (#<BUILT-IN-CLASS SEQUENCE>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS ARRAY>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS LIST>)>))

    (CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE #<BUILT-IN-CLASS LIST>
    '(#<BUILT-IN-CLASS LIST>)
    '(#<STANDARD-METHOD (#<BUILT-IN-CLASS SEQUENCE>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS ARRAY>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS LIST>)>))

    (CLOS::COMPUTE-DISPATCH-RECURSION-BUILT-IN-SUBTREE NIL
    NIL
    '(#<STANDARD-METHOD (#<BUILT-IN-CLASS SEQUENCE>)> #<STANDARD-METHOD (#<BUILT-IN-CLASS ARRAY>)>))

    The latter invocation is incorrect: The first argument should not be NIL.

    In other words, the problem is that the type (AND (AND SEQUENCE (NOT VECTOR)) (NOT LIST)) happens to be empty
    and the code assumes this type (AND class (NOT test-class)) to be non-empty.

    Fixed.

     
  • Bruno Haible

    Bruno Haible - 2012-02-13
    • milestone: 100333 --> lisp error
    • status: open --> closed-fixed
     

Log in to post a comment.