Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the check for outer elements in functions (#8919)
- Make sure we don't fail due to not instantiated outer components before we get to the error check.
- Loading branch information
Showing
5 changed files
with
56 additions
and
12 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
28 changes: 28 additions & 0 deletions
28
testsuite/flattening/modelica/declarations/FunctionRestriction6.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,28 @@ | ||
// name: FunctionRestriction6 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
|
||
function f | ||
input Real x; | ||
output Real y; | ||
protected | ||
outer Real z; | ||
algorithm | ||
y := x * z; | ||
end f; | ||
|
||
model FunctionRestriction6 | ||
Real x = f(1.0); | ||
end FunctionRestriction6; | ||
|
||
// Result: | ||
// Error processing file: FunctionRestriction6.mo | ||
// [flattening/modelica/declarations/FunctionRestriction6.mo:11:3-11:15:writable] Error: Invalid prefix outer on formal parameter z. | ||
// | ||
// # Error encountered! Exiting... | ||
// # Please check the error message and the flags. | ||
// | ||
// Execution failed! | ||
// 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