Opened 14 years ago

Last modified 13 years ago

#1563 closed defect (fixed)

Connectors extending records are not handled

Reported by: Per Östlund Owned by: Per Östlund
Priority: critical Milestone:
Component: Version:
Keywords: Cc: Per Östlund,

Description

When a connector extends from a record it's not handled correctly, since any cref of the connector type will be considered a connector even though it's also a record. This means that when the cref is an input to a function it will be sent as is, instead of a record being created and sent to the function. Here's an example model that will generate invalid C-code because of this issue:

record R
  Real x;
end R;

connector C
  extends R;
end C;

function f
  input C c;
  output Real x;
algorithm
  x := c.x;
end f;

model test
  C c1(x = 2.0);
  Real x;
equation
  x = f(c1);
end test;

Change History (1)

comment:1 by Per Östlund, 13 years ago

It was decided on the modelica design meeting that only basic types and record, or arrays of them, are allowed in functions. Connectors are thus not allowed in functions. A check for this has been implemented in r9753, so the compiler now gives an error for this model.

Note: See TracTickets for help on using tickets.