Commit Graph
9 Commits
Author SHA1 Message Date
Magne Sjaastad ab1cd9bb22 #13603 Replace bool/errorText with std::expected in ExpressionParser
evaluate() and expandIfStatementsAndEvaluate() now return std::expected<void, QString>: the error message is always part of the return value rather than an optional out-parameter, making it impossible for callers to silently discard errors.

Update RimGridCalculation and RimSummaryCalculation to use evaluateResult.error() instead of a separate errorText variable.
2026-02-23 19:19:09 +01:00
copilot-swe-agent[bot] 8bbd0d2551 Improve support for aggregating functions
When aggregating functions (min, max, sum, avg) are applied to a single vector variable, they compute a scalar result over the whole vector. These must be pre-computed before the element-wise for loop, otherwise the variable gets replaced with its indexed version (e.g. min(b) -> min(b[i])) which changes the semantics: min(b[i]) returns b[i], not min of all b.

Add check for pattern: c := agg_func(if(condition, true_expr, false_expr)).  Computes a scalar aggregate of the element-wise if-result and assigns it as a constant to all elements of c.
2026-02-23 19:19:09 +01:00
Magne Sjaastad a060ba349e #7316 Curve Calculator: Add support for single line if-statement 2021-02-02 14:30:26 +01:00
Magne Sjaastad f61c83a659 #2031 Curve Calculator : Sort variable names by the order they first appear 2017-10-23 13:31:57 +02:00
Magne Sjaastad d903226db6 Fix typo in comment 2017-10-23 13:07:49 +02:00
Magne Sjaastad 7c0c45b7b9 Curve Calculator : Do not report detected variables as lowercase 2017-10-19 11:23:30 +02:00
Magne Sjaastad a3cd62d315 #1977 Expression Parser : Add error text if expression compiling fails 2017-10-13 12:22:40 +02:00
Magne Sjaastad 445048c24b #1985 Curve Calculator : Simplify interface to expression parser 2017-10-12 10:52:30 +02:00
Magne Sjaastad c976091336 #1985 Expression Parser: Add exprtk to ThirdParty 2017-10-12 10:52:30 +02:00