From d54c11036183e2b0f8d53c59ae1f68a7401df658 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Thu, 25 Mar 2021 21:41:20 +0100 Subject: [PATCH] cmp: fix bad warnings for type declarations inside locally Also search lexical environment for variables instead of only the list of variables being established by the current form (which is nil anyway in the case of locally; only let or multiple-value-bind statements create new variables). The declaration is still ignored, but fixing that would require a much larger refactor because currently variable types are associated to the variable itself. Thus the type can only be set for the full scope in which the variable is active and not locally in some subscope. --- src/cmp/cmpenv-declare.lsp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmp/cmpenv-declare.lsp b/src/cmp/cmpenv-declare.lsp index 847e74ed6..a7b6c75bb 100644 --- a/src/cmp/cmpenv-declare.lsp +++ b/src/cmp/cmpenv-declare.lsp @@ -176,7 +176,8 @@ special variable declarations, as these have been extracted before." (defun check-vdecl (vnames ts is) (loop for (name . type) in ts unless (or (member name vnames :test #'eq) - (symbol-macro-declaration-p name type)) + (symbol-macro-declaration-p name type) + (cmp-env-search-var name)) do (cmpwarn "Declaration of type~&~4T~A~&was found for not bound variable ~s." type name)) (loop for (name . expected-uses) in is