Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix getModelInstance of derived classes (#9702)
- Call `Typing.typeClassType` before typing anything else in the class, since derived classes will otherwise be in an invalid state. Fixes #9701
- Loading branch information
Showing
4 changed files
with
74 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
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
70 changes: 70 additions & 0 deletions
70
testsuite/openmodelica/instance-API/GetModelInstanceDerived2.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,70 @@ | ||
// name: GetModelInstanceDerived2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
type RealInput = input Real; | ||
type RealInput2 = RealInput(start = 1.0); | ||
"); | ||
|
||
getModelInstance(RealInput, true); getErrorString(); | ||
getModelInstance(RealInput2, true); getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "{ | ||
// \"name\": \"RealInput\", | ||
// \"restriction\": \"type\", | ||
// \"prefixes\": { | ||
// \"direction\": \"input\" | ||
// }, | ||
// \"extends\": { | ||
// \"baseClass\": \"Real\" | ||
// }, | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 2, | ||
// \"columnEnd\": 30 | ||
// } | ||
// }" | ||
// "" | ||
// "{ | ||
// \"name\": \"RealInput2\", | ||
// \"restriction\": \"type\", | ||
// \"modifiers\": { | ||
// \"start\": \"1.0\" | ||
// }, | ||
// \"extends\": { | ||
// \"baseClass\": { | ||
// \"name\": \"RealInput\", | ||
// \"restriction\": \"type\", | ||
// \"prefixes\": { | ||
// \"direction\": \"input\" | ||
// }, | ||
// \"extends\": { | ||
// \"baseClass\": \"Real\" | ||
// }, | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 2, | ||
// \"columnEnd\": 30 | ||
// } | ||
// } | ||
// }, | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 3, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 3, | ||
// \"columnEnd\": 43 | ||
// } | ||
// }" | ||
// "" | ||
// 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