Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Belonging to [master]: - OpenModelica/OMCompiler#2803 - OpenModelica/OpenModelica-testsuite#1082
- Loading branch information
1 parent
e49f7dc
commit 2f21e5a
Showing
3 changed files
with
72 additions
and
0 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,31 @@ | ||
// name: RecordExtends1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
record R | ||
Real x; | ||
end R; | ||
|
||
model M1 | ||
record R1 = R(x = 1.0); | ||
R1 r1; | ||
end M1; | ||
|
||
model M2 | ||
record R2 = R(x = 2.0); | ||
R2 r2; | ||
end M2; | ||
|
||
model RecordExtends1 | ||
M1 m1; | ||
M2 m2; | ||
end RecordExtends1; | ||
|
||
// Result: | ||
// class RecordExtends1 | ||
// Real m1.r1.x = 1.0; | ||
// Real m2.r2.x = 2.0; | ||
// end RecordExtends1; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// name: RecordExtends2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
package P | ||
constant Integer n; | ||
|
||
record R | ||
Real x[n]; | ||
end R; | ||
end P; | ||
|
||
model M1 | ||
package P1 = P(n = 1); | ||
P1.R r1 = P1.R({1.0}); | ||
end M1; | ||
|
||
model M2 | ||
package P2 = P(n = 2); | ||
P2.R r2 = P2.R({1.0, 2.0}); | ||
end M2; | ||
|
||
model RecordExtends2 | ||
M1 m1; | ||
M2 m2; | ||
end RecordExtends2; | ||
|
||
// Result: | ||
// class RecordExtends2 | ||
// Real m1.r1.x[1]; | ||
// Real m2.r2.x[1]; | ||
// Real m2.r2.x[2]; | ||
// equation | ||
// m1.r1.x = {1.0}; | ||
// m2.r2.x = {1.0, 2.0}; | ||
// end RecordExtends2; | ||
// endResult |