aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2025-06-17 09:06:45 +0200
committerAndrea Corallo2025-07-09 10:31:20 +0200
commit05ecb2b8f0216aa3f391ee661aad4d61fd6aed0e (patch)
tree3877c76e27e020d36752b2ca3324d2cf86eda274
parentebb65d41630786f1dac7727f9490d52d8f55e2f9 (diff)
downloademacs-05ecb2b8f0216aa3f391ee661aad4d61fd6aed0e.tar.gz
emacs-05ecb2b8f0216aa3f391ee661aad4d61fd6aed0e.zip
Nativecomp don't error with undeclared types (bug#6573) (don't merge)
Backporting f38e969e472 from trunk to emacs-30 * test/src/comp-resources/comp-test-funcs.el (comp-test-76573-1-f): New function. * lisp/emacs-lisp/comp-cstr.el (comp-supertypes): Don't error if 'type' is unknown.
-rw-r--r--lisp/emacs-lisp/comp-cstr.el10
-rw-r--r--test/src/comp-resources/comp-test-funcs.el20
2 files changed, 27 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 52ed73ff5c3..ca59eb04901 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -336,9 +336,13 @@ Return them as multiple value."
336 (nreverse res)))) 336 (nreverse res))))
337 337
338(defun comp-supertypes (type) 338(defun comp-supertypes (type)
339 "Return the ordered list of supertypes of TYPE." 339 "Return the ordered list of supertypes of TYPE."
340 (or (assq type (comp-cstr-ctxt-typeof-types comp-ctxt)) 340 (or (assq type (comp-cstr-ctxt-typeof-types comp-ctxt))
341 (error "Type %S missing from typeof-types!" type))) 341 (progn
342 (display-warning
343 'native-compiler
344 (format "Unknown type %S" type))
345 '(t))))
342 346
343(defun comp--union-typesets (&rest typesets) 347(defun comp--union-typesets (&rest typesets)
344 "Union types present into TYPESETS." 348 "Union types present into TYPESETS."
diff --git a/test/src/comp-resources/comp-test-funcs.el b/test/src/comp-resources/comp-test-funcs.el
index 72fe71aa359..837ef018efb 100644
--- a/test/src/comp-resources/comp-test-funcs.el
+++ b/test/src/comp-resources/comp-test-funcs.el
@@ -562,6 +562,26 @@
562(defun comp-test-67883-1-f () 562(defun comp-test-67883-1-f ()
563 '#1=(1 . #1#)) 563 '#1=(1 . #1#))
564 564
565(cl-defstruct comp-test-73270-base)
566(cl-defstruct
567 (comp-test-73270-child1 (:include comp-test-73270-base)))
568(cl-defstruct
569 (comp-test-73270-child2 (:include comp-test-73270-base)))
570(cl-defstruct
571 (comp-test-73270-child3 (:include comp-test-73270-base)))
572(cl-defstruct
573 (comp-test-73270-child4 (:include comp-test-73270-base)))
574
575(defun comp-test-73270-1-f (x)
576 (cl-typecase x
577 (comp-test-73270-child1 'child1)
578 (comp-test-73270-child2 'child2)
579 (comp-test-73270-child3 'child3)
580 (comp-test-73270-child4 'child4)))
581
582(defun comp-test-76573-1-f ()
583 (record 'undeclared-type))
584
565 585
566;;;;;;;;;;;;;;;;;;;; 586;;;;;;;;;;;;;;;;;;;;
567;; Tromey's tests ;; 587;; Tromey's tests ;;