Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle incorrect models better in getModelInstance (#10382)
- Try to ignore missing types. - Treat connectors where part of the name can't be found like expandable connectors, to allow connectors referring to elements inside missing types.
- Loading branch information
Showing
8 changed files
with
327 additions
and
25 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
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
72 changes: 72 additions & 0 deletions
72
testsuite/openmodelica/instance-API/GetModelInstanceMissingClass1.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,72 @@ | ||
// name: GetModelInstanceMissingClass1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
model M | ||
MissingClass x = 1.0; | ||
AlsoMissing y[:] = {1, 2, 3}; | ||
end M; | ||
"); | ||
|
||
getModelInstance(M, prettyPrint=true); | ||
getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "{ | ||
// \"name\": \"M\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"x\", | ||
// \"type\": { | ||
// \"name\": \"MissingClass\", | ||
// \"missing\": true | ||
// }, | ||
// \"modifiers\": \"1.0\", | ||
// \"value\": { | ||
// \"binding\": 1 | ||
// } | ||
// }, | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"y\", | ||
// \"type\": { | ||
// \"name\": \"AlsoMissing\", | ||
// \"missing\": true | ||
// }, | ||
// \"dims\": { | ||
// \"absyn\": [ | ||
// \":\" | ||
// ], | ||
// \"typed\": [ | ||
// \"3\" | ||
// ] | ||
// }, | ||
// \"modifiers\": \"{1, 2, 3}\", | ||
// \"value\": { | ||
// \"binding\": [ | ||
// 1, | ||
// 2, | ||
// 3 | ||
// ] | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 5, | ||
// \"columnEnd\": 8 | ||
// } | ||
// }" | ||
// "[<interactive>:3:5-3:25:writable] Error: Class MissingClass not found in scope M. | ||
// [<interactive>:4:5-4:33:writable] Error: Class AlsoMissing not found in scope M. | ||
// " | ||
// endResult |
Oops, something went wrong.