Open
Description
Bug description
Using result
in an expression leads to a runtime error during interpretation. For example, the following code produces an error during the evaluation of the if's condition:
class A {
def boolean isX() {
if (result) {
}
result := false;
}
}
The error is "Couldn't find the 'result' variable".
Expected behavior
Not sure. One of the following:
result
is set a default value,- it is explicitely forbidden to use result without initializing it first and this is enforced by an error marker in the editor.
How to reproduce
Steps to reproduce the behavior:
- Create an ALE project
- Write a semantics that uses
result
in an expression as shown above - Run the interpreter
Additional context
- ALE version: master @ a1a0bf8
Issue caused by the following line:
Since result
has not been initialized yet, the map returned by scopes.getCurrent().getVariableValues()
won't contain it. The appropriate fix depends on the chosen solution.