From fdf5bfa2a1b2563cf626b32b9815959575911ec8 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 17 Jun 2025 09:06:45 +0200 Subject: [PATCH] Make nativecomp don't error when encountering undeclared types (bug#6573) * 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. (cherry picked from commit f38e969e472284dbe475f6f3dbe6770d87588291) --- lisp/emacs-lisp/comp-cstr.el | 10 +++++++--- test/src/comp-resources/comp-test-funcs.el | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 49c2c5d35d1..fad54d4cd46 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -336,9 +336,13 @@ Return them as multiple value." (nreverse res)))) (defun comp-supertypes (type) - "Return the ordered list of supertypes of TYPE." - (or (assq type (comp-cstr-ctxt-typeof-types comp-ctxt)) - (error "Type %S missing from typeof-types!" type))) + "Return the ordered list of supertypes of TYPE." + (or (assq type (comp-cstr-ctxt-typeof-types comp-ctxt)) + (progn + (display-warning + 'native-compiler + (format "Unknown type %S" type)) + '(t)))) (defun comp--union-typesets (&rest typesets) "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 3f7e7d1ab4b..837ef018efb 100644 --- a/test/src/comp-resources/comp-test-funcs.el +++ b/test/src/comp-resources/comp-test-funcs.el @@ -579,6 +579,9 @@ (comp-test-73270-child3 'child3) (comp-test-73270-child4 'child4))) +(defun comp-test-76573-1-f () + (record 'undeclared-type)) + ;;;;;;;;;;;;;;;;;;;; ;; Tromey's tests ;; -- 2.39.5