Opened 12 years ago

Last modified 4 years ago

#2193 closed defect

omc accepts undefined identifiers in structural varying models — at Version 1

Reported by: Christoph Höger Owned by: somebody
Priority: high Milestone: 1.16.0
Component: New Instantiation Version: trunk
Keywords: Cc:

Description (last modified by Martin Sjölund)

model IfExpression
  parameter Boolean b = true;
  Integer i = if not b then c else 1;
equation
  assert(i == 1, "The value of i must be 1");
end IfExpression;

The above model should fail (and there should be a testcase to catch that error).

See: m:#1101#comment:5
I suppose it is because of some inlining/constant folding, as the result looks like this:

class IfExpression
  parameter Boolean b = true;
  Integer i = 1;
equation
  assert(i == 1,"The value of i must be 1");
end IfExpression;

omc should certainly do typechecking _before_ evaluation ;).

Change History (1)

comment:1 by Martin Sjölund, 12 years ago

Description: modified (diff)

I have actually worked on this in the past, and see #1736 for a similar issue. Silly old libraries and other things :(

Note: See TracTickets for help on using tickets.