Here's the code to reproduce the issue:
create or replace package p as
function f(n number) return timestamp;
end p;
/
create or replace package body p as
function f(n number) return timestamp as
begin
return cast(date'1970-01-01' as timestamp) + numtodsinterval(n/1000,'second');
end f;
end p;
/
The code compiles and runs correctly:
select p.f(31*24*60*60*1000) from dual; -- 31 days after 1970-01-01
SQL Developer's SQL Worksheet tab/window (as well as Package Body tab/window) complains about a "Syntax error" in function's body:

SQL Developer version 18.4.0.376, Build 376.1900
Oracle 12c Enterprise, 12.1.0.2.0, 64-bit
Windows 10 Enterprise, 64-bit