mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-26 06:22:33 -08:00
cl_parse_key: correctly handle literal allow-other-keys keyword arguments
When parsing keyword arguments of functions like (defun f (&key allow-other-keys) allow-other-keys) (note that `&key allow-other-keys` is not `&allow-other-keys`!), we were incorrectly handling the case in which this function was called like (f :some-unknown-keyword x :allow-other-keys non-nil-value) In this case, the spec (CLHS 3.4.1.4) says that the function has to ignore the unknown keyword and return the non-nil-value, while we were signaling an "unknown keyword" error.
This commit is contained in:
parent
3ec1ed2ce0
commit
a7e1bf6c9f
1 changed files with 7 additions and 1 deletions
|
|
@ -216,6 +216,12 @@ cl_parse_key(
|
|||
FEprogram_error("Odd number of keys", 0);
|
||||
if (ecl_unlikely(unknown_keyword != OBJNULL && !allow_other_keys &&
|
||||
(supplied_allow_other_keys == ECL_NIL ||
|
||||
supplied_allow_other_keys == OBJNULL)))
|
||||
supplied_allow_other_keys == OBJNULL))) {
|
||||
for (i = 0; i < nkey; i++) {
|
||||
if (keys[i] == @':allow-other-keys' && vars[nkey+i] == ECL_T && !Null(vars[i])) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
FEprogram_error("Unknown keyword ~S", 1, unknown_keyword);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue