This compiler error occurs if the return instruction of one of a typed user-defined functions is not the last instruction before the closing end.
For example.
// user-defined function
function evalConcatenadedDates(nDate1 nDate2) : s
begin
return EvalToken(nDate1, ', [d]-') + EvalToken(nDate2, '[d] [Mmmm]')
LogMessage('Passed through evalConcatenadedDates')
end
// main body of the macro
var
begin
// do some processing
sResult = evalConcatenadedDates(nRunDate, nStartDate)
end
The return instruction of any typed user-defined function must be the last instruction of the function, and the return, placed as it is above, will trigger the present message.
Solution
The solution to the present message is to move the return instruction to the very end of the macro.
// user-defined function
function evalConcatenadedDates(nDate1 nDate2) : s
begin
LogMessage('Passing through evalConcatenadedDates')
return EvalToken(nDate1, ', [d]-') + EvalToken(nDate2, '[d] [Mmmm]')
end
See also: Spurious return in void function and Spurious return in typed function.
Topic 110206, last updated on 15-Oct-2026