Opened 6 years ago

Last modified 6 years ago

#5364 closed enhancement

Obscure error message from NF — at Version 3

Reported by: massimo ceraolo Owned by: Per Östlund
Priority: normal Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description (last modified by massimo ceraolo)

Consider the following code:

model aaa
  parameter Real specificCons[:, :]( unit = "g/(kW.h)") = [0.0, 100; 10, 630];
equation
end aaa;

When checked with the OK I get the following very clear warning:

[1] 17:42:45 Translation Warning
[aaa: 2:38-2:55]: Non-array modification '"g/(kW.h)"' for array component, possibly due to missing 'each'.

When I check with the NF I get instead:

[2] 17:45:38 Translation Error
[aaa: 2:3-2:79]: Type mismatch in binding unit = "g/(kW.h)", expected subtype of String[2, 2], got type String.

which, IMO, is worse.

What makes the second message worse, for me, is:

  • the phrase "subtype of" (with basic types such as Real, Integer, Boolean, String are involved can this be omitted?)
  • the absence of the hint regarding each.

Change History (3)

comment:1 by Francesco Casella, 6 years ago

Component: FrontendNew Instantiation
Milestone: 1.14.02.0.0
Owner: changed from somebody to Per Östlund
Status: newassigned

@ceraolo, 'Subtype of XXX' is the technically correct description of derived types such as, e.g., SI.Units. Consider, for example

type Velocity = Real(unit = "m/s");

which is a subtype of Real.I don't see a problem with that.

However, I completly agree that if we can keep the hint about the missing 'each', when a scalar binding is found instead of an array one, this would be very helpful to users.

@perost, can you take care of that?

in reply to:  1 comment:2 by massimo ceraolo, 6 years ago

Replying to casella:

@ceraolo, 'Subtype of XXX' is the technically correct description of derived types such as, e.g., SI.Units. Consider, for example

type Velocity = Real(unit = "m/s");

which is a subtype of Real.I don't see a problem with that.

I think here we have a different situation.
It is just that String is a subtype of String. Removing "Subtype of", IMO clarifies.
I mean, the message would remain technically correct, but clearer.

Last edited 6 years ago by massimo ceraolo (previous) (diff)

comment:3 by massimo ceraolo, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.