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

Type declaration on anonymous function arguments in macro not working on 1.5 #37134

Closed
raminammour opened this issue Aug 20, 2020 · 1 comment · Fixed by #37181
Closed

Type declaration on anonymous function arguments in macro not working on 1.5 #37134

raminammour opened this issue Aug 20, 2020 · 1 comment · Fixed by #37181
Assignees
Labels
kind:regression Regression in behavior compared to a previous version macros @macros

Comments

@raminammour
Copy link
Contributor

Hello,

Originally broke DistributedArrays, filed here. It turns out it is about type declaration of an anonymous function argument inside a macro (that was a mouthful :P).

julia> macro bla()
       :(x :: Int -> 62)
       end
@bla (macro with 1 method)

julia> @bla
ERROR: syntax: malformed expression
Stacktrace:
 [1] top-level scope at REPL[2]:1

This stopped working on version 1.5, was working as of 1.4 (works without the type declaration ::Int). Curiously, eval(:(x::Int -> 62)) works too.

Cheers!

@martinholters
Copy link
Member

Likely hygiene-related, as this works:

macro bla()
    :($(esc(:x))::Int -> 62)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:regression Regression in behavior compared to a previous version macros @macros
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants