﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3058	Type mismatch in functions with an if clause	Willi Braun	somebody	"Following model results into a Type mismatch, which is actually not there.
{{{
loadString(""
function f
  input Real A[:,size(A, 1)];
  output Real H[size(A,1),size(A,2)];

protected
  Integer n=size(A,1);

algorithm
 print(\""Size A \"" + String(size(A,1)) + \""\\n\"");
 if size(A,1) == 0 then
   H := fill(0,0,0); // <= Shouldn't evaluated
 end if;
 for i in 1:n loop
   for j in 1:n loop
     H[i, j] := H[i,j] + 1.0;
   end for;
  end for;
end f;

model test
  Real msr_mat[2, 2];
equation
  msr_mat  = f({{1,0},{0,1}});
end test;
"");
getErrorString();
simulate(test);
getErrorString();
}}}
=>
{{{
Error: Type mismatch in assignment in H := {} of Real[size(A, 1), size(A, 2)] := Integer[0, 0]
}}}
The Modelica function Modelica.Math.Matrices.cholesky is also effected by this bug."	defect	closed	high	1.16.0	New Instantiation	trunk	fixed		
