Skip to main content

UndeclaredKeywordParameter

rascal-0.34.0

Synopsis

A function is called with a keyword parameter that was not declared in the function's declaration.

Description

Rascal functions may have keyword parameters. This error is generated when a function call uses an undeclared keyword parameter.

Remedies:

  • Rename the keyword parameter in the call.
  • Add a new keyword parameter to the function.

Examples

rascal>int incr(int n, int delta=1) = n + delta;
int (int, int delta = ...): function(|prompt:///|(0,41,<1,0>,<1,41>))

Calling incr with a wrong keyword parameter gives a warning:

rascal>incr(3, diff=5);
int: 4
info

The warning that is normally printed is not included in this document.

This can be fixed by using the correct name for the keyword parameter:

rascal>incr(3, delta=5);
int: 8