Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Declare DynamicSelect to be impure (#9806)
- Declare DynamicSelect to be impure to make sure the compiler doesn't try to evaluate it.
- Loading branch information
Showing
3 changed files
with
104 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
102 changes: 102 additions & 0 deletions
102
testsuite/openmodelica/instance-API/GetModelInstanceAnnotation5.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,102 @@ | ||
// name: GetModelInstanceAnnotation5 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
model M | ||
annotation(Icon(graphics = { | ||
Rectangle(extent = DynamicSelect({{0, 0}, {20, 20}}, {{0, 0}, {20, 30}})) | ||
})); | ||
end M; | ||
"); | ||
|
||
getModelInstance(M, prettyPrint=true); | ||
|
||
// Result: | ||
// true | ||
// "{ | ||
// \"name\": \"M\", | ||
// \"restriction\": \"model\", | ||
// \"annotation\": { | ||
// \"Icon\": { | ||
// \"graphics\": [ | ||
// { | ||
// \"$kind\": \"record\", | ||
// \"name\": \"Rectangle\", | ||
// \"elements\": [ | ||
// true, | ||
// [ | ||
// 0, | ||
// 0 | ||
// ], | ||
// 0, | ||
// [ | ||
// 0, | ||
// 0, | ||
// 0 | ||
// ], | ||
// [ | ||
// 0, | ||
// 0, | ||
// 0 | ||
// ], | ||
// { | ||
// \"$kind\": \"enum\", | ||
// \"name\": \"LinePattern.Solid\", | ||
// \"index\": 2 | ||
// }, | ||
// { | ||
// \"$kind\": \"enum\", | ||
// \"name\": \"FillPattern.None\", | ||
// \"index\": 1 | ||
// }, | ||
// 0.25, | ||
// { | ||
// \"$kind\": \"enum\", | ||
// \"name\": \"BorderPattern.None\", | ||
// \"index\": 1 | ||
// }, | ||
// { | ||
// \"$kind\": \"call\", | ||
// \"name\": \"DynamicSelect\", | ||
// \"arguments\": [ | ||
// [ | ||
// [ | ||
// 0, | ||
// 0 | ||
// ], | ||
// [ | ||
// 20, | ||
// 20 | ||
// ] | ||
// ], | ||
// [ | ||
// [ | ||
// 0, | ||
// 0 | ||
// ], | ||
// [ | ||
// 20, | ||
// 30 | ||
// ] | ||
// ] | ||
// ] | ||
// }, | ||
// 0 | ||
// ] | ||
// } | ||
// ] | ||
// } | ||
// }, | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 6, | ||
// \"columnEnd\": 8 | ||
// } | ||
// }" | ||
// 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