Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of function parameter variability (#10836)
- Remove variability prefixes from function parameters since they have no semantic meaning, to avoid e.g. function inputs being constant evaluated. - Add some debug output from EvalFunction using the existing evalFuncDump debug flag. Fixes #10828
- Loading branch information
Showing
9 changed files
with
82 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
testsuite/flattening/modelica/scodeinst/FuncVariability.mo
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
testsuite/flattening/modelica/scodeinst/FunctionParamVariability.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// name: FunctionParamVariability | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// Checks that declaring a function parameter constant/parameter has no impact | ||
// on the function, since variability prefixes have no semantic meaning for | ||
// function parameters. | ||
// | ||
|
||
function f | ||
constant input Real x = 1.0; | ||
parameter output Real y = x + x; | ||
end f; | ||
|
||
model FunctionParamVariability | ||
Real x = f(time); | ||
end FunctionParamVariability; | ||
|
||
// Result: | ||
// function f | ||
// input Real x = 1.0; | ||
// output Real y = x + x; | ||
// end f; | ||
// | ||
// class FunctionParamVariability | ||
// Real x = f(time); | ||
// end FunctionParamVariability; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters