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

Macro bug with keyword arguments #28900

Closed
yurivish opened this issue Aug 26, 2018 · 0 comments
Closed

Macro bug with keyword arguments #28900

yurivish opened this issue Aug 26, 2018 · 0 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior macros @macros

Comments

@yurivish
Copy link
Contributor

yurivish commented Aug 26, 2018

julia> macro foo(x)
           quote
               $x
           end
       end
@foo (macro with 1 method)

julia> f(; kwarg) = kwarg
f (generic function with 1 method)

julia> @foo f(kwarg = x -> x)
ERROR: syntax: "Main.x" is not a valid function argument name

It seems like the keyword argument specification is the culprit here. The same macro works on a call without a keyword argument:

julia> g(arg) = arg
g (generic function with 1 method)

julia> @foo g(x -> x)
#5 (generic function with 1 method)

julia> versioninfo()
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)
Environment:
  JULIA_EDITOR = subl
@JeffBezanson JeffBezanson added the macros @macros label Aug 27, 2018
@JeffBezanson JeffBezanson self-assigned this Aug 29, 2018
@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Sep 4, 2018
KristofferC pushed a commit that referenced this issue Sep 6, 2018
KristofferC pushed a commit that referenced this issue Sep 8, 2018
KristofferC pushed a commit that referenced this issue Sep 8, 2018
KristofferC pushed a commit that referenced this issue Feb 11, 2019
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 macros @macros
Projects
None yet
Development

No branches or pull requests

2 participants