Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle invalid components better in instance API (#12211)
- Mark components as invalid if the typing of them fails in any way with the instance API, and dump them similar to deleted components along with any error messages.
- Loading branch information
Showing
6 changed files
with
121 additions
and
7 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
63 changes: 63 additions & 0 deletions
63
testsuite/openmodelica/instance-API/GetModelInstanceBinding10.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,63 @@ | ||
// name: GetModelInstanceBinding10 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
model A | ||
Real x[:, :]; | ||
end A; | ||
|
||
model M | ||
A a(x = [0, -1; 1, 1, 1.1, -1]); | ||
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\", | ||
// \"$error\": \"[<interactive>:3:5-3:17:writable] Error: Type mismatch for positional argument 2 in cat(arg=cat(2, {{0}}, {{-1}})). The argument has type:\\n Real[1, 2]\\nexpected type:\\n Real[:, 4]\\n\" | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 4, | ||
// \"columnEnd\": 8 | ||
// } | ||
// }, | ||
// \"modifiers\": { | ||
// \"x\": \"[0, -1; 1, 1, 1.1, -1]\" | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 6, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 8, | ||
// \"columnEnd\": 8 | ||
// } | ||
// }" | ||
// "" | ||
// endResult |
2 changes: 1 addition & 1 deletion
2
testsuite/openmodelica/instance-API/GetModelInstanceBinding9.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
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