Opened 11 years ago
Closed 11 years ago
#2687 closed defect (fixed)
Overloading '-'
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | Mahder Alemseged Gebremedhin, krsta |
Description (last modified by )
The following generates the same code for both assignments (wrong for subtraction):
operator record C Real r; encapsulated operator 'constructor' import C; function fromReal input Real r; output C c; algorithm c.r := r; end fromReal; end 'constructor'; encapsulated operator function '+' import C; input C c1,c2; output C c; algorithm c.r := c1.r + c2.r; end '+'; encapsulated operator function '-' import C; input C c1,c2; output C c; algorithm c.r := c1.r - c2.r; end '-'; end C; model M C c1,c2; Real r; algorithm c2 := r - c1; c2 := c1 - r; end M;
Change History (4)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 11 years ago
Cc: | added |
---|
Also, fix so we do not allow:
encapsulated operator function '+' import C; input C c1,c2; output Real r; algorithm r := c1.r + c2.r; end '+';
And some more things in the spec...
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed, except comment:3 which is actually allowed on closer reading of the spec.
Note:
See TracTickets
for help on using tickets.
I'll work on cleaning up record overloading a bit