forked from OpenModelica/OpenModelica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix evaluation of call type dimensions (OpenModelica#12618)
- Mark dimension expressions as structural when evaluating the type of a function call, to avoid having them be marked as non-structural when they depend on external functions. Fixes OpenModelica#12605
- Loading branch information
Showing
4 changed files
with
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// name: DimUnknown16 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
function f | ||
input Integer nrow; | ||
input Integer ncol; | ||
output Real[nrow, ncol] matrix; | ||
external "C" f(nrow, ncol, matrix); | ||
end f; | ||
|
||
impure function f2 | ||
input Integer dummy; | ||
output Integer dim; | ||
external "C" dim = strlen("aa"); | ||
end f2; | ||
|
||
model DimUnknown16 | ||
parameter Integer dummy = 0; | ||
parameter Integer dim = f2(dummy); | ||
parameter Real A[:, :] = f(dim, dim); | ||
end DimUnknown16; | ||
|
||
// Result: | ||
// impure function f | ||
// input Integer nrow; | ||
// input Integer ncol; | ||
// output Real[nrow, ncol] matrix; | ||
// | ||
// external "C" f(nrow, ncol, matrix); | ||
// end f; | ||
// | ||
// class DimUnknown16 | ||
// final parameter Integer dummy = 0; | ||
// final parameter Integer dim = 2; | ||
// parameter Real[2, 2] A = f(2, 2); | ||
// end DimUnknown16; | ||
// 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
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