[Ecls-list] Patch: FTYPE proclamations with DEFTYPE'd types.

Josh Elsasser josh at elsasser.org
Mon Sep 1 22:28:11 UTC 2008


I forgot to send this one before, it attempts to normalize the types
used in an FTYPE declaration or proclamation so that function types
defined with DEFTYPE can be used.

--- src/cmp/cmpenv.lsp
+++ src/cmp/cmpenv.lsp
@@ -198,12 +198,15 @@
          (proclaim-var (second decl) (cddr decl))
          (error "Syntax error in proclamation ~s" decl)))
     (FTYPE
-     (let (ftype)
+     (let (ftype fargs)
        (cond ((and (consp (cdr decl))
 		   (consp (setf ftype (second decl)))
-		   (eq (first ftype) 'FUNCTION))
+		   (multiple-value-bind (ntype nargs)
+		       (si::normalize-type ftype)
+		     (and (eq ntype 'FUNCTION)
+			  (consp (setf fargs nargs)))))
 	      (dolist (v (cddr decl))
-		(add-function-proclamation v (rest ftype))))
+		(add-function-proclamation v fargs)))
 	     (t (error "Syntax error in proclamation ~a" decl)))))
     (INLINE
      (dolist (fun (cdr decl))
@@ -391,12 +394,15 @@
 	       (COMPILATION-SPEED)
 	       (t (cmpwarn "The OPTIMIZE quality ~s is unknown." (car x))))))))
       (FTYPE
-       (let (ftype)
+       (let (ftype fargs)
 	 (cond ((and (consp (cdr decl))
 		     (consp (setq ftype (second decl)))
-		     (eq (first ftype) 'FUNCTION))
+		     (multiple-value-bind (ntype nargs)
+			 (si::normalize-type ftype)
+		       (and (eq ntype 'FUNCTION)
+			    (consp (setf fargs nargs)))))
 		(dolist (v (cddr decl))
-		  (add-function-declaration v (second ftype) (cddr ftype))))
+		  (add-function-declaration v (first fargs) (rest fargs))))
 	       (t (cmpwarn "Syntax error in declaration ~s" decl)))))
       (INLINE
        (push decl dl)




More information about the ecl-devel mailing list