#1749 closed defect (fixed)
Improve tuple assignment error messages
Reported by: | Peter Aronsson | Owned by: | Peter Aronsson |
---|---|---|---|
Priority: | critical | Milestone: | 1.9.0 |
Component: | Frontend | Version: | |
Keywords: | Cc: | Peter Aronsson |
Description (last modified by )
The following model:
model Model1 Real[3] x; Real y; function test input Real x; input Real x2; output Real y[3]; output Real z; algorithm y:={x,x2 + 1,x + 2}; z:=x2^2; end test; algorithm (y,x):=test(time, time^2); end Model1;
produces the following error messages:
Error processing file: model1.mo [model1.mo:15:3-15:28:writable] Error: Type mismatch in assignment in (y,x) := M odel1.test(time,time ^ 2.0) of (Real, Real[3]) := (Real[3], Real)
[model1.mo:15:3-15:28:writable] Error: Tuple assignment only allowed when rhs is function call (in Model1.test(time,time ^ 2.0)) Error: Error occurred while flattening model Model1
Clearly, the second error is not true, and it should not be printed. This is a common type of mistake in the compiler that probably originates from the fail semantics of RML combined with unsufficient programming logic ;-)
Change History (5)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
No, it is a valid expression, that's what makes the error message so strange.
comment:3 by , 12 years ago
Cc: | petar, → petar |
---|---|
Description: | modified (diff) |
comment:4 by , 12 years ago
Milestone: | → 1.9.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Summary: | Tuple assignment error produces two error messages, whereof one is not right → Improve tuple assignment error messages |
Fixed in r12665.
comment:5 by , 12 years ago
Component: | Instantiation → Frontend |
---|
Note:
See TracTickets
for help on using tickets.
The logic is correct: the rhs is not a function call since it is an invalid expression. Nevertheless, it is not needed and should be removed.