@@ -1423,9 +1423,10 @@ protected
14231423 list< Expression > args;
14241424 list< NamedArg > named_args;
14251425 Expression arg1, arg2;
1426- Type ty1;
1426+ Type ty1, ty2 ;
14271427 Variability var ;
14281428 Function fn;
1429+ TypeCheck . MatchKind mk;
14291430 algorithm
14301431 UNTYPED_CALL (ref = fn_ref, arguments = args, named_args = named_args) := call;
14311432
@@ -1442,7 +1443,7 @@ protected
14421443
14431444 {arg1, arg2} := args;
14441445 (arg1, ty1, var ) := Typing . typeExp(arg1, origin, info);
1445- (arg2, ty , variability) := Typing . typeExp(arg2, origin, info);
1446+ (arg2, ty2 , variability) := Typing . typeExp(arg2, origin, info);
14461447
14471448 // First argument must be Integer.
14481449 if not Type . isInteger(ty1) then
@@ -1461,10 +1462,12 @@ protected
14611462 // Second argument must be Real, array of allowed expressions or record
14621463 // containing only components of allowed expressions.
14631464 // TODO: Also handle records here.
1464- if not Type . isReal(Type . arrayElementType(ty)) then
1465+ (arg2, ty, mk) := TypeCheck . matchTypes(ty2, Type . setArrayElementType(ty2, Type . REAL ()), arg2, true );
1466+
1467+ if not TypeCheck . isCompatibleMatch(mk) then
14651468 Error . addSourceMessageAndFail(Error . ARG_TYPE_MISMATCH ,
14661469 {"2" , ComponentRef . toString(fn_ref), "" , Expression . toString(arg2),
1467- Type . toString(ty ), "Real \n Real[:, ...] \n Real record \n Real record[:, ...]" }, info);
1470+ Type . toString(ty2 ), "Real \n Real[:, ...] \n Real record \n Real record[:, ...]" }, info);
14681471 end if ;
14691472
14701473 {fn} := typeCachedFunctions(fn_ref);
0 commit comments