Browse Source

Fix evaluateExact for unary minus

We should propagate the EvaluateContext into the inner expression.

The missing 'ec' led to exceptions in model construction for exact/parametric mode, as variable valuations are then not available, e.g., when used in guards ('-s' where 's' is a state variable).

Checked the other evaluateExact calls, those are fine.
accumulation-v4.7
Joachim Klein 7 years ago
committed by GitHub
parent
commit
7b8a4628d0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      prism/src/parser/ast/ExpressionUnaryOp.java

2
prism/src/parser/ast/ExpressionUnaryOp.java

@ -144,7 +144,7 @@ public class ExpressionUnaryOp extends Expression
case NOT: case NOT:
return BigRational.from(!operand.evaluateExact(ec).toBoolean()); return BigRational.from(!operand.evaluateExact(ec).toBoolean());
case MINUS: case MINUS:
return operand.evaluateExact().negate();
return operand.evaluateExact(ec).negate();
case PARENTH: case PARENTH:
return operand.evaluateExact(ec); return operand.evaluateExact(ec);
} }

Loading…
Cancel
Save