@@ -58,61 +58,68 @@ protected
5858public
5959 function verify
6060 input FlatModel flatModel;
61+ input Boolean isPartial;
6162 algorithm
6263 for var in flatModel. variables loop
63- verifyVariable(var );
64+ verifyVariable(var , isPartial );
6465 end for ;
6566
6667 for eq in flatModel. equations loop
67- verifyEquation(eq);
68+ verifyEquation(eq, isPartial );
6869 end for ;
6970
7071 for ieq in flatModel. initialEquations loop
71- verifyEquation(ieq);
72+ verifyEquation(ieq, isPartial );
7273 end for ;
7374
7475 for alg in flatModel. algorithms loop
75- verifyAlgorithm(alg);
76+ verifyAlgorithm(alg, isPartial );
7677 end for ;
7778
7879 for ialg in flatModel. initialAlgorithms loop
79- verifyAlgorithm(ialg);
80+ verifyAlgorithm(ialg, isPartial );
8081 end for ;
8182
8283 // check for discrete real variables not assigned in when equations (#5836)
83- checkDiscreteReal(flatModel);
84+ if not isPartial then
85+ checkDiscreteReal(flatModel);
86+ end if ;
8487
8588 execStat(getInstanceName());
8689 end verify;
8790
8891protected
8992 function verifyVariable
9093 input Variable var ;
94+ input Boolean isPartial;
9195 algorithm
92- verifyBinding(var . binding);
96+ verifyBinding(var . binding, isPartial );
9397
9498 for attr in var . typeAttributes loop
95- verifyBinding(Util . tuple22(attr));
99+ verifyBinding(Util . tuple22(attr), isPartial );
96100 end for ;
97101
98102 for v in var . children loop
99- verifyVariable(v);
103+ verifyVariable(v, isPartial );
100104 end for ;
101105 end verifyVariable;
102106
103107 function verifyBinding
104108 input Binding binding;
109+ input Boolean isPartial;
105110 algorithm
106111 if Binding . isBound(binding) then
107- checkSubscriptBounds(Binding . getTypedExp(binding), Binding . getInfo(binding));
112+ checkSubscriptBounds(Binding . getTypedExp(binding), isPartial, Binding . getInfo(binding));
108113 end if ;
109114 end verifyBinding;
110115
111116 function verifyEquation
112117 input Equation eq;
118+ input Boolean isPartial;
113119 algorithm
114120 () := match eq
115121 case Equation . WHEN ()
122+ guard not isPartial
116123 algorithm
117124 verifyWhenEquation(eq. branches, eq. source);
118125 then
@@ -121,7 +128,7 @@ protected
121128 else ();
122129 end match;
123130
124- Equation . applyExpShallow(eq, function checkSubscriptBounds(info = Equation . info(eq)));
131+ Equation . applyExpShallow(eq, function checkSubscriptBounds(isPartial = isPartial, info = Equation . info(eq)));
125132 end verifyEquation;
126133
127134 function verifyWhenEquation
@@ -251,31 +258,35 @@ protected
251258
252259 function verifyAlgorithm
253260 input Algorithm alg;
261+ input Boolean isPartial;
254262 algorithm
255- Algorithm . apply(alg, verifyStatement);
263+ Algorithm . apply(alg, function verifyStatement(isPartial = isPartial) );
256264 end verifyAlgorithm;
257265
258266 function verifyStatement
259267 input Statement stmt;
268+ input Boolean isPartial;
260269 algorithm
261- Statement . applyExp(stmt, function checkSubscriptBounds(info = Statement . info(stmt)));
270+ Statement . applyExp(stmt, function checkSubscriptBounds(isPartial = isPartial, info = Statement . info(stmt)));
262271 end verifyStatement;
263272
264273 function checkSubscriptBounds
265274 input Expression exp;
275+ input Boolean isPartial;
266276 input SourceInfo info;
267277 algorithm
268- Expression . apply(exp, function checkSubscriptBounds_traverser(info = info));
278+ Expression . apply(exp, function checkSubscriptBounds_traverser(isPartial = isPartial, info = info));
269279 end checkSubscriptBounds;
270280
271281 function checkSubscriptBounds_traverser
272282 input Expression exp;
283+ input Boolean isPartial;
273284 input SourceInfo info;
274285 algorithm
275286 () := match exp
276287 case Expression . CREF ()
277288 algorithm
278- checkSubscriptBoundsCref(exp. cref, info);
289+ checkSubscriptBoundsCref(exp. cref, isPartial, info);
279290 then
280291 ();
281292
@@ -285,6 +296,7 @@ protected
285296
286297 function checkSubscriptBoundsCref
287298 input ComponentRef cref;
299+ input Boolean isPartial;
288300 input SourceInfo info;
289301 algorithm
290302 () := match cref
@@ -308,14 +320,17 @@ protected
308320 Error . addSourceMessage(Error . ARRAY_INDEX_OUT_OF_BOUNDS ,
309321 {Subscript . toString(s), String (index),
310322 Dimension . toString(d), ComponentRef . firstName(cref)}, info);
311- fail();
323+
324+ if not isPartial then
325+ fail();
326+ end if ;
312327 end if ;
313328 end if ;
314329
315330 index := index + 1 ;
316331 end for ;
317332
318- checkSubscriptBoundsCref(cref. restCref, info);
333+ checkSubscriptBoundsCref(cref. restCref, isPartial, info);
319334 then
320335 ();
321336
0 commit comments