opendylan
opendylan copied to clipboard
No error when wrong keyword arg passed to bare method
This assertion in dylan-test-suite fails:
check-condition("one key call wrong supplied", <error>,
begin
local method m (#key x) x end;
// Stifle compiler warning we get if called directly.
let methods = list(m);
methods[0](y: 1);
end);
From https://opendylan.org/books/drm/Parameter_Lists, "If a function that accepts keyword arguments is called, it will signal an error if called with a keyword argument that it does not permit...." A bare method like this without #all-keys or #rest doesn't permit y:.
This looks like the same issue to me, but with #rest:
check-condition("rest one key call one arg", <error>,
begin
local method m (#rest k, #key) k end;
// Stifle compiler warning we get if called directly.
let methods = list(m);
methods[0](y: 1)
end);
Yes, I made note of this in the dylan-lang/general chat on 2019-11-01. Some, but not all, of the entry point code (in both C and LLVM back-ends) check for invalid keywords.