-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instantiate record constructors as functions (#12362)
- Instantiate record constructors as functions, to avoid creating binding equations from start values for parameters without bindings.
- Loading branch information
Showing
3 changed files
with
33 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
31 changes: 31 additions & 0 deletions
31
testsuite/flattening/modelica/scodeinst/RecordConstructor4.mo
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: RecordConstructor4 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
record R | ||
parameter Real x(start = 1.0); | ||
end R; | ||
|
||
model RecordConstructor4 | ||
R r; | ||
equation | ||
r = R(time); | ||
end RecordConstructor4; | ||
|
||
// Result: | ||
// function R "Automatically generated record constructor for R" | ||
// input Real x; | ||
// output R res; | ||
// end R; | ||
// | ||
// class RecordConstructor4 | ||
// parameter Real r.x(start = 1.0); | ||
// equation | ||
// r = R(time); | ||
// end RecordConstructor4; | ||
// [flattening/modelica/scodeinst/RecordConstructor4.mo:9:3-9:32:writable] Warning: Parameter r.x has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value. | ||
// | ||
// endResult |