Skip to content

Commit

Permalink
Fixed defmethod priority. fixed subclassp
Browse files Browse the repository at this point in the history
  • Loading branch information
sasagawa888 committed Nov 10, 2024
1 parent 9ab68dc commit cea2402
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions data.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ int subclassp(int x, int y)
return (0);
else if (y == cobject)
return (1);
else if (x == cobject)
return(0);
else
return (subclassp1(x, y));
}
Expand Down
3 changes: 1 addition & 2 deletions tests/bug.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@

(print-self (create (class <child>)))
;; => Expected PARENT:<class <CHILD>>, Not exit matched method at PRINT-SELF (<instance>)
#|

(defmethod print-self ((obj <object>))
(format (standard-output) "OBJECT:~S~%" (class-of obj)))

(print-self (create (class <parent>)))
;; => PARENT:<class <PARENT>>
(print-self (create (class <child>)))
;; => Expected PARENT:<class <CHILD>>, but OBJECT:<class <CHILD>>.
|#

0 comments on commit cea2402

Please sign in to comment.