Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 2ba9e4b

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Update the call type when type casting.
Belonging to [master]: - #2956
1 parent 69a3ec4 commit 2ba9e4b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Compiler/NFFrontEnd/NFCall.mo

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,11 +850,14 @@ uniontype Call
850850
input Type ty;
851851
protected
852852
Call call;
853+
Type cast_ty;
853854
algorithm
854855
Expression.CALL(call = call) := callExp;
855856

856857
callExp := match call
857858
case TYPED_CALL() guard Function.isBuiltin(call.fn)
859+
algorithm
860+
cast_ty := Type.setArrayElementType(call.ty, ty);
858861
then
859862
match Absyn.pathFirstIdent(Function.name(call.fn))
860863
// For 'fill' we can type cast the first argument rather than the
@@ -863,6 +866,7 @@ uniontype Call
863866
algorithm
864867
call.arguments := Expression.typeCast(listHead(call.arguments), ty) ::
865868
listRest(call.arguments);
869+
call.ty := cast_ty;
866870
then
867871
Expression.CALL(call);
868872

@@ -871,10 +875,11 @@ uniontype Call
871875
case "diagonal"
872876
algorithm
873877
call.arguments := {Expression.typeCast(listHead(call.arguments), ty)};
878+
call.ty := cast_ty;
874879
then
875880
Expression.CALL(call);
876881

877-
else Expression.CAST(Type.setArrayElementType(call.ty, ty), callExp);
882+
else Expression.CAST(cast_ty, callExp);
878883
end match;
879884

880885
else Expression.CAST(Type.setArrayElementType(typeOf(call), ty), callExp);

0 commit comments

Comments
 (0)