Opened 6 years ago
Closed 6 years ago
#5034 closed defect (invalid)
Here old FE had a better error message.
Reported by: | massimo ceraolo | Owned by: | Per Östlund |
---|---|---|---|
Priority: | normal | Milestone: | 1.13.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: |
Description
Consider the following code:
model a Real x=1; parameter Integer N=2; parameter Real R1[N, N](unit="Ohm/m") = 0.3*[1, 0; 0, 1]/1000 "resistances per unit length"; equation end a;
Old FE issues the following warning:
[1] 08:35:42 Translation Warning [a: 4:26-4:38]: Non-array modification '"Ohm/m"' for array component, possibly due to missing 'each'.
which is very clear. For the same code the new FE issues an error, with the following message:
[2] 08:36:40 Translation Error [a: 4:2-5:40]: Type mismatch in binding unit = "Ohm/m", expected subtype of String[2, 2], got type String.
I don't know whether this should be a warning or an error. Anyway, the Old FE message is clearer from the user point-of-view. I propose a message similar to the old one, or a combination of old and new ones.
Change History (2)
comment:1 by , 6 years ago
Component: | Frontend → New Instantiation |
---|---|
Owner: | changed from | to
comment:2 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Replying to ceraolo:
It is indeed an error, because the code is invalid. R1 is a two-dimensional array, so the unit modifier should also be a two-dimensional array of the same dimension, as suggested by the error message.
Alternatively, you can use 'each', as in
that compiles and runs with the NF.
The old FE was a bit more tolerant on missing 'each', but that could have led to problems, so we decided to be strict with the handling of such modifiers, according to the specification.
@perost, in these cases (type error in bindings due to wrong dimensions) could we perhaps add a suggestion to add 'each' in the error message? That could help a lot understanding how to fix the problem.