﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4635	Record fields types are not preserved for nested structures initialized without using Record constructor.	jabozzo@…	Per Östlund	"In the folowing example:

{{{
package Example

  record A
    parameter Modelica.SIunits.Voltage param_a;
  end A;
  
  record B
    parameter A param_b;
  end B;
  
  constant A a0(param_a = 0);
  constant B b0(param_b = a0);
  
  constant A a1 = A(param_a = 0);
  constant B b1 = B(param_b = a1);
  
  model Bug
    parameter B params = b0;
  end Bug;
  
  model NormalA
    parameter A params = a0;
  end NormalA;
  
  model NormalB
    parameter B params = b1;
  end NormalB;
  
end Example;
}}}

Models NormalA and NormalB compile fine but Model Bug has the following error:


{{{
[1] 19:28:40 Translation Error
[Example: 18:5-18:28]: Type mismatch in binding param_b = Example.A$a0(0), expected subtype of record Example.A
  Real(quantity = ""ElectricPotential"", unit = ""V"") param_a;
end Example.A;, got type record Example.A$a0
  Integer param_a;
end Example.A$a0;.
}}}


Notice that constant a0's parameter, param_a. It's type has been changed to Integer, giving the mismatch, but this only occurs inside b0. A workaround can be using Record constructors, as in model NormalB. Sadly that workaround can't avoid bug #2365 .

Also, this bug may be related to #4623, since the nesting of the structures A and B is necesary for the bug, since NormalA can use a0 without problems.
"	defect	closed	high	1.19.0	Frontend	v1.13.0-dev-nightly	fixed	structure, record, nested	
