Opened 11 years ago
Closed 5 years ago
#3058 closed defect (fixed)
Type mismatch in functions with an if clause
| Reported by: | Willi Braun | Owned by: | somebody |
|---|---|---|---|
| Priority: | high | Milestone: | 1.16.0 |
| Component: | New Instantiation | Version: | trunk |
| Keywords: | Cc: |
Description
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.
Change History (1)
comment:1 by , 5 years ago
| Component: | Frontend → New Instantiation |
|---|---|
| Milestone: | Future → 1.16.0 |
| Resolution: | → fixed |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

Works fine in the new frontend.