Skip to main content

UndeclaredAnnotation

rascal-0.40.17

Synopsis

An annotation is used that has not been declared.

Description

An annotation can be used to add information to an instance of an algebraic data type. An annotation has to declared beforehand. This error is generated when an undeclared annotation is used.

Remedies:

  • Declare the annotation.
  • Use an already declared annotation.

Examples

This is correct:

rascal>data Fruit = apple(int n) | orange(int n);
ok
rascal>anno str Fruit @ quality;
ok
rascal>piece = orange(13);
Fruit: orange(13)
rascal>piece@quality = "great";
Fruit: orange(13,quality="great")

But using a wrong annotation name generates an error:

rascal>piece@qual
|prompt:///|(0,5,<1,0>,<1,5>): Function orange has no keyword parameter qual
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UndeclaredKeywordParameter|
ok