Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve typing of array constructor in relaxed context (#10615)
- Don't require the range of an array constructor to have a known size when in a relaxed context. - Propagate the context to Typing.getRecordElementBinding.
- Loading branch information
Showing
4 changed files
with
95 additions
and
4 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
85 changes: 85 additions & 0 deletions
85
testsuite/openmodelica/instance-API/GetModelInstanceExp2.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,85 @@ | ||
// name: GetModelInstanceExp2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
model M | ||
parameter Integer n; | ||
Real x[3] = {i for i in 1:n}; | ||
end M; | ||
"); | ||
|
||
getModelInstance(M, prettyPrint = true); | ||
|
||
// Result: | ||
// true | ||
// "{ | ||
// \"name\": \"M\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"n\", | ||
// \"type\": \"Integer\", | ||
// \"prefixes\": { | ||
// \"variability\": \"parameter\" | ||
// } | ||
// }, | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"x\", | ||
// \"type\": \"Real\", | ||
// \"dims\": { | ||
// \"absyn\": [ | ||
// \"3\" | ||
// ], | ||
// \"typed\": [ | ||
// \"3\" | ||
// ] | ||
// }, | ||
// \"modifiers\": \"{i for i in 1:n}\", | ||
// \"value\": { | ||
// \"binding\": { | ||
// \"$kind\": \"iterator_call\", | ||
// \"name\": \"$array\", | ||
// \"exp\": { | ||
// \"$kind\": \"cref\", | ||
// \"parts\": [ | ||
// { | ||
// \"name\": \"i\" | ||
// } | ||
// ] | ||
// }, | ||
// \"iterators\": [ | ||
// { | ||
// \"name\": \"i\", | ||
// \"range\": { | ||
// \"$kind\": \"range\", | ||
// \"start\": 1, | ||
// \"stop\": { | ||
// \"$kind\": \"cref\", | ||
// \"parts\": [ | ||
// { | ||
// \"name\": \"n\" | ||
// } | ||
// ] | ||
// } | ||
// } | ||
// } | ||
// ] | ||
// } | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 5, | ||
// \"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