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.
This commit is contained in:
Marius Gerbershagen 2021-03-25 21:41:20 +01:00
parent 977e2fab34
commit d54c110361

View file

@ -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