-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't fail on invalid modifiers in instance API (#12038)
Fixes #12032
- Loading branch information
Showing
3 changed files
with
81 additions
and
2 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
68 changes: 68 additions & 0 deletions
68
testsuite/openmodelica/instance-API/GetModelInstanceMod5.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,68 @@ | ||
// name: GetModelInstanceMod5 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
model A | ||
protected | ||
Real x; | ||
end A; | ||
|
||
model M | ||
A a(x = 1.0); | ||
end M; | ||
"); | ||
|
||
getModelInstance(M, prettyPrint = true); | ||
getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "{ | ||
// \"name\": \"M\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"a\", | ||
// \"type\": { | ||
// \"name\": \"A\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"x\", | ||
// \"type\": \"Real\", | ||
// \"prefixes\": { | ||
// \"public\": false | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 5, | ||
// \"columnEnd\": 8 | ||
// } | ||
// }, | ||
// \"modifiers\": { | ||
// \"x\": \"1.0\" | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 7, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 9, | ||
// \"columnEnd\": 8 | ||
// } | ||
// }" | ||
// "[<interactive>:8:9-8:16:writable] Notification: From here: | ||
// [<interactive>:4:5-4:11:writable] Error: Protected element 'x' may not be modified, got 'x = 1.0'. | ||
// " | ||
// 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