Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve conditional array type handling (#8414)
- Return unknown dimensions for conditional array types in Type.arrayDims instead of an empty array, so at least the number of dimensions is correct (needed by `cat`). - Handle type checking when both the expected and the actual type is a conditonal array type.
- Loading branch information
Showing
4 changed files
with
82 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// name: IfExpression14 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
model IfExpression14 | ||
parameter Boolean cond = false; | ||
Real[3] a = if cond then {1.0} else {1.0, 2.0, 3.0}; | ||
Real x[:] = cat(1, a, a); | ||
end IfExpression14; | ||
|
||
// Result: | ||
// class IfExpression14 | ||
// parameter Boolean cond = false; | ||
// Real a[1]; | ||
// Real a[2]; | ||
// Real a[3]; | ||
// Real x[1]; | ||
// Real x[2]; | ||
// Real x[3]; | ||
// Real x[4]; | ||
// Real x[5]; | ||
// Real x[6]; | ||
// equation | ||
// a = {1.0, 2.0, 3.0}; | ||
// x = {a[1], a[2], a[3], a[1], a[2], a[3]}; | ||
// end IfExpression14; | ||
// 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