Opened 10 years ago

Closed 3 years ago

Last modified 3 years ago

#2802 closed defect (fixed)

Some issues with casting in constructor

Reported by: vitalij Owned by: somebody
Priority: normal Milestone: 1.19.0
Component: Frontend Version: trunk
Keywords: Cc:

Description

Consider this example

package A
  operator record R
    Real x[n];
    parameter Integer n;

    encapsulated operator 'constructor'
      import A.R;

      function fromRealArray
        input Real x[n];
        input Integer n;
        output R result(x = x, n = n);
      algorithm

        annotation(Inline = true);
      end fromRealArray;
    end 'constructor';
  end R;

  model B
    R r = R(x = {1, 2}, n = 2);
    //R r = R(x = {1.0, 2}, n = 2); //work
  end B;
end A;

we get a "Type mismatch".

Change History (2)

comment:1 Changed 3 years ago by perost

  • Milestone changed from Future to 1.18.0
  • Resolution set to fixed
  • Status changed from new to closed

The new frontend flattens the model correctly to:

class A.B
  Real r.x[1];
  Real r.x[2];
  final parameter Integer r.n = 2;
equation
  r.x = {1.0, 2.0};
end A.B;

comment:2 Changed 3 years ago by casella

  • Milestone changed from 1.18.0 to 1.19.0
Note: See TracTickets for help on using tickets.