Skip to content

Commit

Permalink
More conditional array type fixes (#7851)
Browse files Browse the repository at this point in the history
  • Loading branch information
perost committed Sep 2, 2021
1 parent e6b71af commit c0fb919
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions OMCompiler/Compiler/NFFrontEnd/NFTypeCheck.mo
Expand Up @@ -2185,23 +2185,23 @@ algorithm
cond_ty := Type.CONDITIONAL_ARRAY(comp_ty1, comp_ty2, NFType.Branch.NONE);
condExp := Expression.typeCast(condExp, cond_ty);
then
(cond_ty, otherExp, mk1);
(comp_ty1, otherExp, mk1);

// Only the first branch matches, mark it as the correct branch.
case (true, _)
algorithm
cond_ty := Type.CONDITIONAL_ARRAY(comp_ty1, comp_ty2, NFType.Branch.TRUE);
condExp := Expression.typeCast(e1_1, cond_ty);
then
(cond_ty, e2_1, mk1);
(comp_ty1, e2_1, mk1);

// Only the second branch matches, mark it as the correct branch.
case (_, true)
algorithm
cond_ty := Type.CONDITIONAL_ARRAY(comp_ty1, comp_ty2, NFType.Branch.FALSE);
condExp := Expression.typeCast(e1_2, cond_ty);
then
(cond_ty, e2_2, mk2);
(comp_ty2, e2_2, mk2);

else (condType, condExp, mk1);
end match;
Expand Down Expand Up @@ -2250,23 +2250,23 @@ algorithm
cond_ty := Type.CONDITIONAL_ARRAY(comp_ty1, comp_ty2, NFType.Branch.NONE);
exp := Expression.typeCast(exp, cond_ty);
then
(cond_ty, mk1);
(comp_ty1, mk1);

// Only the first branch matches, mark it as the correct branch.
case (true, _)
algorithm
cond_ty := Type.CONDITIONAL_ARRAY(comp_ty1, false_ty, NFType.Branch.TRUE);
exp := Expression.typeCast(e1, cond_ty);
then
(cond_ty, mk1);
(comp_ty1, mk1);

// Only the second branch matches, mark it as the correct branch.
case (_, true)
algorithm
cond_ty := Type.CONDITIONAL_ARRAY(true_ty, comp_ty2, NFType.Branch.FALSE);
exp := Expression.typeCast(e2, cond_ty);
then
(cond_ty, mk2);
(comp_ty2, mk2);

else (condType, mk1);
end match;
Expand Down

0 comments on commit c0fb919

Please sign in to comment.