Skip to content

Commit

Permalink
[NF] Fix equation counting for _.
Browse files Browse the repository at this point in the history
- Set wildcard crefs (_) to be Type.UNKNOWN() instead of Type.ANY(),
  to avoid them being counted when counting equations.

Belonging to [master]:
  - OpenModelica/OMCompiler#2959
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 4, 2019
1 parent b691eb1 commit f0376d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Compiler/NFFrontEnd/NFComponentRef.mo
Expand Up @@ -262,7 +262,7 @@ public
case CREF()
then getSubscriptedType2(cref.restCref, Type.subscript(cref.ty, cref.subscripts));
case EMPTY() then Type.UNKNOWN();
case WILD() then Type.ANY();
case WILD() then Type.UNKNOWN();
end match;
end getSubscriptedType;

Expand Down
6 changes: 6 additions & 0 deletions Compiler/NFFrontEnd/NFTypeCheck.mo
Expand Up @@ -2589,7 +2589,13 @@ algorithm
end if;

for ty2 in tyl2 loop
// Skip matching if the rhs is _.
if Type.isUnknown(ty2) then
continue;
end if;

ty1 :: tyl1 := tyl1;

(_, _, matchKind) := matchTypes(ty1, ty2, expression, allowUnknown);

if matchKind <> MatchKind.EXACT then
Expand Down

0 comments on commit f0376d4

Please sign in to comment.