﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3183	Unknown dimensions during record construction	Rüdiger Franke	somebody	"In case someone digs into the details of #3182, here is a related problem with the construction of records that contain arrays with dimensions determined by parameters of the records.
{{{#!mo
package UnknownSize
  record R
    parameter Integer nr;
    Real[nr] vr;
  end R;

  operator record S
    parameter Integer ns;
    Real[ns] vs;
  end S;

  function precalculation
    input R r;
    output S s(ns = r.nr);
  algorithm
    s.vs := 2*r.vr;
  end precalculation;

  model M1 ""Translation error:
  Could not evaluate structural parameter (or constant): ns which gives dimensions of array: vs[ns]. Array dimensions must be known at compile time.
  ""
    parameter R r(nr = 2, vr = {1, 2});
    parameter S s = precalculation(r);
  end M1;

  model M2 ""Translation error:
  Type mismatch for named argument in UnknownSize.R(vr={1, 2}). The argument has type: Integer[2] expected type: Real[nr]
  ""
    parameter R r = R(nr = 2, vr = {1.0, 2.0});
    parameter R r2 = R(nr = 2, vr = {1, 2});
    parameter S s = precalculation(r);
  end M2;

  model M3 ""Compilation error:
  UnknownSize.M3_06inz.c:54:31: error: use of undeclared identifier '$Ps$Pr$Pnr'
    $Ps$Pns = (modelica_integer)$Ps$Pr$Pnr;
                                ^
  ""
    parameter R r(nr = 2, vr = {1, 2});
    record S2 = S(ns = r.nr);
    parameter S2 s = precalculation(r);
  end M3;
end UnknownSize;
}}}

`UnknownSize.M1` fails to evaluate the structural parameter `s.ns` during flattening.

`UnknownSize.M2` is able to calculate evaluate `r.nr` if a record constructor is used (instead of the arbitrary function `precalculation`). The record constructor fails to instantiate the Real array `r2.vr` with an Integer array though.

`UnknownSize.M3` introduces `S2` as a workaround to pass the frontend; afterwards it fails during compilation though."	defect	closed	high	Future	Frontend	trunk	fixed		
