From 097fa96ae07dabfa7512592c0ee51901ec69669c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Fri, 19 Apr 2019 22:11:52 +0200 Subject: [PATCH] cmp: coerce: resolve fixme for atomic complex specifier it is not true, that (type= '(complex) '(complex double-float)) == T so we may put complex in +coercion-table+. --- src/cmp/cmpopt.lsp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/cmp/cmpopt.lsp b/src/cmp/cmpopt.lsp index 62fc55902..cb5485489 100644 --- a/src/cmp/cmpopt.lsp +++ b/src/cmp/cmpopt.lsp @@ -215,6 +215,9 @@ (single-float . (float x 0.0f0)) (double-float . (float x 0.0d0)) (long-float . (float x 0.0l0)) + (complex . (let ((y x)) + (declare (:read-only y)) + (complex (realpart y) (imagpart y)))) (base-char . (character x)) (character . (character x)) (function . (si::coerce-to-function x)) @@ -251,15 +254,7 @@ when (eq type a-type) do (return (subst value 'x template)))) ;; - ;; FIXME! COMPLEX cannot be in +coercion-table+ because - ;; (type= '(complex) '(complex double-float)) == T - ;; - ((eq type 'COMPLEX) - `(let ((y ,value)) - (declare (:read-only y)) - (complex (realpart y) (imagpart y)))) - ;; - ;; Complex types defined with DEFTYPE. + ;; Derived types defined with DEFTYPE. ((and (atom type) (setq first (si:get-sysprop type 'SI::DEFTYPE-DEFINITION))) (expand-coerce form value `',(funcall first nil) env))