Commit a7e1bf6c authored by Marius Gerbershagen's avatar Marius Gerbershagen
Browse files

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.
parent 3ec1ed2c
......@@ -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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment