Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Compiler/NFFrontEnd/NFCall.mo
Original file line number Diff line number Diff line change
Expand Up @@ -850,11 +850,14 @@ uniontype Call
input Type ty;
protected
Call call;
Type cast_ty;
algorithm
Expression.CALL(call = call) := callExp;

callExp := match call
case TYPED_CALL() guard Function.isBuiltin(call.fn)
algorithm
cast_ty := Type.setArrayElementType(call.ty, ty);
then
match Absyn.pathFirstIdent(Function.name(call.fn))
// For 'fill' we can type cast the first argument rather than the
Expand All @@ -863,6 +866,7 @@ uniontype Call
algorithm
call.arguments := Expression.typeCast(listHead(call.arguments), ty) ::
listRest(call.arguments);
call.ty := cast_ty;
then
Expression.CALL(call);

Expand All @@ -871,10 +875,11 @@ uniontype Call
case "diagonal"
algorithm
call.arguments := {Expression.typeCast(listHead(call.arguments), ty)};
call.ty := cast_ty;
then
Expression.CALL(call);

else Expression.CAST(Type.setArrayElementType(call.ty, ty), callExp);
else Expression.CAST(cast_ty, callExp);
end match;

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