Opened 11 years ago
Closed 6 years ago
#2365 closed defect (fixed)
Record constructor does not set dependent parameters
Reported by: | Owned by: | Per Östlund | |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | 1.9.0Beta |
Keywords: | Cc: |
Description (last modified by )
model emptyVector1 record R parameter Integer i = 2; parameter Real x[i]=zeros(i); end R; R r = R(i = 0); end emptyVector1;
The call to the record constructor should enable the definition of r. But here the size of r.x is [2]
and in the constructor [0]
. -> incompatible sizes... (OMC r15030)
Change History (15)
comment:1 by , 11 years ago
Component: | Backend → Frontend |
---|---|
Description: | modified (diff) |
Owner: | changed from | to
comment:2 by , 11 years ago
Summary: | Record cannot be set by constructor due to incompatible vector sizes → Record constructor does not set dependent parameters |
---|
comment:4 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:5 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:7 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:10 by , 8 years ago
Milestone: | 1.10.0 → 2.0.0 |
---|
comment:11 by , 7 years ago
Component: | Frontend → New Instantiation |
---|---|
Owner: | changed from | to
Priority: | blocker → high |
Status: | accepted → assigned |
As of v1.13.0-dev-672-g87286cb84, the result with the NF is
[1] 00:05:31 Translation Error [OMCompiler/Compiler/NFFrontEnd/NFRangeIterator.mo: 212:11-213:61]: Internal error NFRangeIterator.hasNext got invalid range R.i
I don't see this as a critical bug, so I am removing the blocker status. If this affects any existing library, feel free to make it a blocker for 2.0.0 again.
follow-up: 13 comment:12 by , 6 years ago
Milestone: | 2.0.0 → 2.1.0 |
---|
The NF now reports:
[emptyVector1: 4:5-4:33]: Could not evaluate structural parameter (or constant): r.i which gives dimensions of array: x. Array dimensions must be known at compile time.
which is a bit odd, as i is obviously as structural parameter. For some reason, it is not recognized as such.
As this issue is most likely not affecting the library coverage, I am postponing it to 2.1.0
comment:13 by , 6 years ago
Replying to casella:
As this issue is most likely not affecting the library coverage, I am postponing it to 2.1.0
I'm fairly certain it does affect library coverage. There's some similar issues in some libraries (I think BuildingSystems, I don't remember exactly), where the size of a record field depends on another record field. But I don't think it affects the MSL.
comment:15 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Works with -d=newInst
using omc v1.14.0-dev-105-g2de3e7582
The workaround is (as usual), to not use the record constructor, but rather just modify the record. OMC is a little stupid sometimes.
I have not looked closer into the specification. It might be that you should not be able to do this. But from what I have remember, default arguments to functions should be handled specially; and not the way OMC does, i.e. no binding uses a different execution path from with binding.