Roger-luo/Expronicon.jl

Error parsing function with return type annotation

domluna opened this issue · 2 comments

julia> ex2 = @expr function f(x; a=10)::Int
           return x
       end
:(function f(x; a = 10)::Int
      #= REPL[148]:1 =#
      #= REPL[148]:2 =#
      return x
  end)

julia> JLFunction(ex2)
ERROR: expect function head expr expression, got f(x; a = 10)::Int.
Stacktrace:
 [1] anlys_error(expect::String, got::Expr)
   @ Expronicon ~/.julia/packages/Expronicon/RauF7/src/analysis.jl:89
 [2] split_function_head(ex::Expr)
   @ Expronicon ~/.julia/packages/Expronicon/RauF7/src/analysis.jl:391
 [3] JLFunction(ex::Expr)
   @ Expronicon ~/.julia/packages/Expronicon/RauF7/src/analysis.jl:504
 [4] top-level scope
   @ REPL[149]:1

should be fixed by #12 , but since I'm releasing https://github.com/Roger-luo/ExproniconLite.jl I'd like to wait this new package gets release then backport the fix there.

FYI, to get the JLFunction object, you can just write

ex2 = @expr JLFunction function f(x; a=10)::Int
       return x
end

should be fixed now, I'll close this first.