Skip to content

Commit

Permalink
Fix unassigned variable in NFCall (#7313)
Browse files Browse the repository at this point in the history
- Fixes #6431.
  • Loading branch information
perost committed Mar 18, 2021
1 parent bba553f commit ccf632c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFCall.mo
Expand Up @@ -2441,6 +2441,8 @@ protected
if isSome(oexp) then
SOME(outExp) := oexp;
// TODO: Apply subscripts.
else
outExp := exp;
end if;
then
outExp;
Expand Down
31 changes: 31 additions & 0 deletions testsuite/flattening/modelica/scodeinst/FuncUnknownDim3.mo
@@ -0,0 +1,31 @@
// name: FuncUnknownDim3
// keywords:
// status: correct
// cflags: -d=newInst
//

function f
input Real[n] v;
output Real[n] result = fill(1.0, n);
protected
parameter Integer n = size(v, 1);
end f;

model FuncUnknownDim3
Real x[2] = f({time, 1});
end FuncUnknownDim3;

// Result:
// function f
// input Real[n] v;
// output Real[n] result = fill(1.0, n);
// protected parameter Integer n = n;
// end f;
//
// class FuncUnknownDim3
// Real x[1];
// Real x[2];
// equation
// x = f({time, 1.0});
// end FuncUnknownDim3;
// endResult
1 change: 1 addition & 0 deletions testsuite/flattening/modelica/scodeinst/Makefile
Expand Up @@ -528,6 +528,7 @@ FuncStringInvalid1.mo \
FuncStringInvalid2.mo \
FuncUnknownDim1.mo \
FuncUnknownDim2.mo \
FuncUnknownDim3.mo \
FuncVariability.mo \
FuncViaComp.mo \
FuncViaComp2.mo \
Expand Down

0 comments on commit ccf632c

Please sign in to comment.