guicho271828/macroexpand-dammit — pull request #4 by DalekBaldwin (2014-11-21 09:44:34+00:00)
Title: Fix type declaration problem with imposed let-bindings

This is a fix for the problem I brought up in the comments for issue #1. The handler for `let` imposes dummy bindings in order to clear out any existing symbol-macro bindings in the environment so they won't be triggered by macroexpansions further down the code tree. But this should only be strictly necessary if there is already a symbol-macro binding for the symbol for which we are establishing a let-binding, which is something we can explicitly check. In Common Lisp it is a static error to create a symbol-macro binding for an existing global variable in the first place, so by only imposing dummy bindings where there is an active symbol-macro binding, we can ensure that we never cause a compiler error by inadvertently imposing a nil binding for a global variable that has been `declaim`ed to have some non-nil type.