Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow top level outer on an non standard flag (#11041)
- Loading branch information
Showing
5 changed files
with
45 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package TestNonStandardExtensions | ||
|
||
model InnerDefinition | ||
parameter Real x = 1; | ||
end InnerDefinition; | ||
|
||
model TestTopLevelOuter | ||
outer InnerDefinition o; | ||
parameter Real y = 2; | ||
end TestTopLevelOuter; | ||
|
||
end TestNonStandardExtensions; |
30 changes: 30 additions & 0 deletions
30
testsuite/flattening/modelica/others/TestTopLevelOuter.mos
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,30 @@ | ||
// name: TestTopLevelOuter.mos | ||
// keywords: non-standard Modelica extensions | ||
// status: correct | ||
// | ||
// Test non-standard Modelica flags that allow usage of integer as enums and enums as integers | ||
// | ||
// | ||
|
||
loadFile("TestTopLevelOuter.mo"); getErrorString(); | ||
instantiateModel(TestNonStandardExtensions.TestTopLevelOuter); getErrorString(); | ||
setCommandLineOptions("--allowNonStandardModelica=nonStdTopLevelOuter"); getErrorString(); | ||
instantiateModel(TestNonStandardExtensions.TestTopLevelOuter); getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// "" | ||
// "[flattening/modelica/others/TestTopLevelOuter.mo:8:3-8:26:writable] Error: The model can't be instantiated due to top-level outer element 'o', it may only be used as part of a simulation model. | ||
// " | ||
// true | ||
// "" | ||
// "class TestNonStandardExtensions.TestTopLevelOuter | ||
// parameter Real y = 2.0; | ||
// parameter Real o.x = 1.0; | ||
// end TestNonStandardExtensions.TestTopLevelOuter; | ||
// " | ||
// "[flattening/modelica/others/TestTopLevelOuter.mo:8:3-8:26:writable] Warning: The model can't be instantiated due to top-level outer element 'o', it may only be used as part of a simulation model. | ||
// [flattening/modelica/others/TestTopLevelOuter.mo:8:3-8:26:writable] Warning: An inner declaration for outer component o could not be found and was automatically generated. | ||
// " | ||
// endResult |