![]() |
|
Navigation |
Synopsis A value of a different type was expected.
Description This error signals an incompatibility between expected type and actual type.
Some of the situations in which this may occur are
Rascal:Assert, Rascal:Declarations/Variable, Rascal:Solve.
Remedy: adjust the actual type to the expected type.
Examples Declaring variable
n as int and assigning it a str value gives an error:
rascal>int n = "abc";
|stdin:///|(4,9,<1,4>,<1,13>): Expected int, but got str
The solution is to assign an int value to n :
rascal>int n = 123;
int: 123
An assert statement expects an argument of type bool :
rascal>assert 3;
|stdin:///|(0,9,<1,0>,<1,9>): Expected bool, but got int
![]() |