Skip to content

Commit

Permalink
[NF] Minor fixes.
Browse files Browse the repository at this point in the history
- Fix type when evaluating reductions.
- Don't do branch selection during typing for if-expressions with
  conditions that contain non-evaluatable expressions.

Belonging to [master]:
  - OpenModelica/OMCompiler#2423
  • Loading branch information
perost authored and OpenModelica-Hudson committed May 9, 2018
1 parent 1bed3ff commit 59a392a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Compiler/NFFrontEnd/NFCeval.mo
Expand Up @@ -2177,7 +2177,7 @@ algorithm
expl := evalReduction2(exp, el_ty, ranges_rest, iters_rest, origin) :: expl;
end while;

result := Expression.ARRAY(el_ty, listReverseInPlace(expl));
result := Expression.ARRAY(ty, listReverseInPlace(expl));
end if;
end evalReduction2;

Expand Down
3 changes: 2 additions & 1 deletion Compiler/NFFrontEnd/NFTyping.mo
Expand Up @@ -1837,7 +1837,8 @@ algorithm
fail();
end if;

if cond_var <= Variability.STRUCTURAL_PARAMETER then
if cond_var <= Variability.STRUCTURAL_PARAMETER and
not Expression.contains(cond, isNonConstantIfCondition) then
// If the condition is constant, always do branch selection.
if evaluateCondition(cond, origin, info) then
(ifExp, ty, var) := typeExp(tb, next_origin, info);
Expand Down

0 comments on commit 59a392a

Please sign in to comment.