Skip to content

Commit

Permalink
[NF] Potential fix for #5063.
Browse files Browse the repository at this point in the history
- Treat functions with a discrete output variable as implicitly
  discrete if the arguments are continuous.

Belonging to [master]:
  - OpenModelica/OMCompiler#2604
  • Loading branch information
perost authored and OpenModelica-Hudson committed Aug 13, 2018
1 parent 01f7068 commit 9840114
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Compiler/NFFrontEnd/NFCall.mo
Expand Up @@ -353,6 +353,12 @@ uniontype Call
ty := getSpecialReturnType(func, args);
end if;

// Functions that return a discrete type, e.g. Integer, should probably be
// treated as implicitly discrete if the arguments are continuous.
if Type.isDiscrete(ty) and var == Variability.CONTINUOUS then
var := Variability.IMPLICITLY_DISCRETE;
end if;

if intBitAnd(origin, ExpOrigin.FUNCTION) == 0 then
ty := evaluateCallType(ty, func, args);
end if;
Expand Down

0 comments on commit 9840114

Please sign in to comment.