Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 1a07660

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Ceval fixes.
- Allow ceval of constant binding to fail for now, since ceval isn't complete. - Handle Modelica.Math builtins. - Fix bad interval check for asin/acos. Belonging to [master]: - #2088 - OpenModelica/OpenModelica-testsuite#808
1 parent 481bef0 commit 1a07660

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Compiler/NFFrontEnd/NFCeval.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ function evalBuiltinCall
356356
input EvalTarget target;
357357
output Expression result;
358358
protected
359-
Absyn.Path fn_path = Function.name(fn);
359+
Absyn.Path fn_path = Function.nameConsiderBuiltin(fn);
360360
algorithm
361361
result := match Absyn.pathFirstIdent(fn_path)
362362
case "abs" then evalBuiltinAbs(listHead(args));
@@ -450,7 +450,7 @@ algorithm
450450
result := match arg
451451
case Expression.REAL(value = x)
452452
algorithm
453-
if x <= -1.0 or x >= 1.0 then
453+
if x < -1.0 or x > 1.0 then
454454
if EvalTarget.hasInfo(target) then
455455
Error.addSourceMessage(Error.ARGUMENT_OUT_OF_RANGE,
456456
{String(x), "acos", "-1 <= x <= 1"}, EvalTarget.getInfo(target));
@@ -486,7 +486,7 @@ algorithm
486486
result := match arg
487487
case Expression.REAL(value = x)
488488
algorithm
489-
if x <= -1.0 or x >= 1.0 then
489+
if x < -1.0 or x > 1.0 then
490490
if EvalTarget.hasInfo(target) then
491491
Error.addSourceMessage(Error.ARGUMENT_OUT_OF_RANGE,
492492
{String(x), "asin", "-1 <= x <= 1"}, EvalTarget.getInfo(target));

Compiler/NFFrontEnd/NFTyping.mo

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,13 @@ algorithm
609609

610610
// Evaluate the binding if the component is a constant.
611611
if comp_var == Variability.CONSTANT then
612-
binding := evalBinding(binding);
612+
// TODO: Allow this to fail for now. Once constant evaluation has
613+
// been improved we should print an error when a constant binding
614+
// couldn't be evaluated instead.
615+
try
616+
binding := evalBinding(binding);
617+
else
618+
end try;
613619
end if;
614620

615621
c.binding := binding;

0 commit comments

Comments
 (0)