Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix extends of builtin type in getModelInstance (#10070)
- Set the `isDerived` class to `true` when building instance trees for extends, otherwise extends of builtin types are incorrectly optimized away and cause issues later on. Fixes #10069
- Loading branch information
Showing
3 changed files
with
58 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
56 changes: 56 additions & 0 deletions
56
testsuite/openmodelica/instance-API/GetModelInstanceExtends3.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,56 @@ | ||
// name: GetModelInstanceExtends3 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
type MyReal | ||
extends Real; | ||
end MyReal; | ||
|
||
model M | ||
MyReal x; | ||
end M; | ||
"); | ||
getErrorString(); | ||
|
||
getModelInstance(M, prettyPrint=true); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// "{ | ||
// \"name\": \"M\", | ||
// \"restriction\": \"model\", | ||
// \"components\": [ | ||
// { | ||
// \"name\": \"x\", | ||
// \"type\": { | ||
// \"name\": \"MyReal\", | ||
// \"restriction\": \"type\", | ||
// \"extends\": [ | ||
// { | ||
// \"baseClass\": \"Real\" | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 4, | ||
// \"columnEnd\": 13 | ||
// } | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 6, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 8, | ||
// \"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