Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add return type to signature #5

Open
oxinabox opened this issue Mar 28, 2020 · 0 comments
Open

Add return type to signature #5

oxinabox opened this issue Mar 28, 2020 · 0 comments
Labels
signature relating to the signature function to get def from methods

Comments

@oxinabox
Copy link
Member

This is a follow up for once #1 is complete.
At least of of now it never generates the return type.

But it could, it would requires some inspecting of the Code Lowered.

julia> f(x)::Int = round(Int, x)
f (generic function with 1 method)

julia> meth = first(methods(f))
f(x) in Main at REPL[16]:1

julia> Base.uncompressed_ast(meth)
CodeInfo(
    @ REPL[16]:1 within `f'
1 ─ %1 = Main.Int
│   %2 = Main.round(Main.Int, x)
│   %3 = Base.convert(%1, %2)
│   %4 = Core.typeassert(%3, %1)
└──      return %4
)
``
@oxinabox oxinabox added the signature relating to the signature function to get def from methods label Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
signature relating to the signature function to get def from methods
Projects
None yet
Development

No branches or pull requests

1 participant