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

at-generated function(...) ... end just returns the unmodified anonymous function #18930

Open
fcard opened this issue Oct 14, 2016 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@fcard
Copy link
Contributor

fcard commented Oct 14, 2016

julia> const f = @generated function(x) :(x+1) end
(::#1) (generic function with 1 method)

julia> f(1)
:(x + 1)

0.6.0-dev.974

@StefanKarpinski
Copy link
Member

Hah. That's actually really useful for demoing. I wish I'd known about it before.

@JeffBezanson JeffBezanson added bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage) labels Jun 5, 2017
@fcard
Copy link
Contributor Author

fcard commented Nov 26, 2017

This situation seems to have changed a bit.

julia> const f = @generated function(x) :(x+1) end
ERROR: invalid @generated function; try placing it in global scope

julia> @generated function(x) :(x+1) end
#4 (generic function with 1 method)

julia> const f = ans
#4 (generic function with 1 method)

julia> f(1)
2

0.7.0-DEV.2610

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

No branches or pull requests

3 participants