Skip to content

Commit 39b4916

Browse files
committed
fix(eieio): only run analysis of instance if instance arg is present
1 parent e1770b8 commit 39b4916

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

elsa-extension-eieio.el

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@
5858
(or slot-names "no slots"))))))))))
5959

6060
(defun elsa--eieio-assert-struct-for-obj (instance state)
61-
(let ((type (elsa-get-type instance)))
62-
;; This test instead of `elsa-class-type-p' is so that mixed can
63-
;; be used as a struct.
64-
(unless (elsa-type-assignable-p (elsa-make-type (class nil)) type)
65-
(elsa-state-add-message state
66-
(elsa-make-error instance
67-
"Type `%s' has no properties because it is not a class."
68-
:code "eieio-not-a-class"
69-
(elsa-type-describe type))))))
61+
(when instance
62+
(let ((type (elsa-get-type instance)))
63+
;; This test instead of `elsa-class-type-p' is so that mixed can
64+
;; be used as a struct.
65+
(unless (elsa-type-assignable-p (elsa-make-type (class nil)) type)
66+
(elsa-state-add-message state
67+
(elsa-make-error instance
68+
"Type `%s' has no properties because it is not a class."
69+
:code "eieio-not-a-class"
70+
(elsa-type-describe type)))))))
7071

7172
(defun elsa--analyse:oref (form scope state)
7273
(let* ((instance (elsa-cadr form))

0 commit comments

Comments
 (0)