-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macroexpand-1 handling of shadowing in lexical environment #1556
Labels
Comments
Lines 701 to 706 in 4f5fd46
lookupMacro returns nil because the macro is shadowed, but macro-function takes this to mean it's not bound locally at all, so it uses the global definition.
Testing a fix. |
Bike
added a commit
to s-expressionists/Cleavir
that referenced
this issue
Jan 31, 2024
See clasp-developers/clasp#1556. macro-function did not respect local function shadowing, so with code like (macrolet ((g ...)) (flet ((g ...)) ...)) it would return the macro, inappropriately.
Bike
added a commit
that referenced
this issue
Jan 31, 2024
There is a similar problem with Cleavir environments, so #1556 is not fixed yet.
Merged
Bike
added a commit
that referenced
this issue
Jan 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In a local lexical environment, functions defined by
flet
shadow macros introduced both bymacrolet
anddefmacro
. Normal execution implements this, butmacroexpand-1
doesn't seem to.Expected behavior
(macroexpand-1 '(f) env)
returns(f)
whenf
is inenv
as a function introduced byflet
, regardless of presence of global macros defined bydefmacro
or lexically-scoped macros defined bymacrolet
.Actual behavior
A macro is expanded. An older version failed to shadow both local and global ones, a fresh version shadows the local ones but the global macros are still not shadowed.
Code at issue
Expected:
(g)
Actual on 2.2.0 from Nixpkgs:
1
Actual on 2.5.0 on Debian Bookworm from thirdlaw.tech repo:
3
If
(e (g))
is replaced with(progn (g))
, both expected an actual behaviour is to return2
.Context
2.5.0-85-gd23de8b43
Freshly installed Debian Bookworm VM
(clasp-cltl2:declaration-information 'optimize)
)Not changed; everything equal to 1
Hopefully irrelevant, but https://gitlab.common-lisp.net/mraskin/agnostic-lizard/-/issues/6 (trying to check if examples.lisp failures are my fault or bugs in Clasp)
The text was updated successfully, but these errors were encountered: