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

esc cannot be used in function arguments #16096

Closed
MikeInnes opened this issue Apr 28, 2016 · 5 comments
Closed

esc cannot be used in function arguments #16096

MikeInnes opened this issue Apr 28, 2016 · 5 comments
Assignees
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) kind:bug Indicates an unexpected problem or unintended behavior

Comments

@MikeInnes
Copy link
Member

module Foo
macro iter()
  quote
    @inline function Base.start(sub)
      it = 1
    end
  end
end
end

Macroexpanding Foo.@iter yields a function with an argument Foo.sub and a local Foo.it, both of which are broken.

In fewer cases (but still in this case) 0.4 also qualifies sub, but gensyms it correctly.

@MikeInnes MikeInnes changed the title Broken function argument/local escaping in macroexpansion Broken function argument/local escaping when using @inline Apr 28, 2016
@yuyichao
Copy link
Contributor

Ref #10887

@MikeInnes
Copy link
Member Author

Another issue is that without the inline macro it's not possible to escape function argument names. I don't think that's a regression though (I think I might have seen an issue for it somewhere).

@JeffBezanson JeffBezanson self-assigned this Apr 28, 2016
@JeffBezanson JeffBezanson added the kind:bug Indicates an unexpected problem or unintended behavior label Apr 28, 2016
JeffBezanson added a commit that referenced this issue May 2, 2016
fix #16096, incorrect var renaming inside macrocall exprs in macroexpand
@vtjnash vtjnash reopened this May 3, 2016
@vtjnash
Copy link
Sponsor Member

vtjnash commented May 3, 2016

looks like it's still broken / the fix broke something else: http:https://buildbot.e.ip.saba.us:8010/builders/perf_nanosoldier-x64/builds/201

@JeffBezanson
Copy link
Sponsor Member

I can reproduce that on 0.4:

julia> macro foo()
        quote
         function foo($(esc(:x)))
           x
         end
       end
       end

julia> @foo
ERROR: syntax: "(escape x)" is not a valid function argument name

Maybe there was some intermediate time where it worked on master.

@yuyichao yuyichao changed the title Broken function argument/local escaping when using @inline esc cannot be used in function arguments May 29, 2016
@MikeInnes
Copy link
Member Author

Also, I'm not able to escape the entire signature when using block syntax:

:($(:(f())) = 1) # works
:(function $(:(f())) 1 end) # syntax: expected "end" in definition of function "($ '(call f))"

@JeffBezanson JeffBezanson added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Aug 15, 2016
JeffBezanson added a commit that referenced this issue Jun 1, 2017
JeffBezanson added a commit that referenced this issue Jun 1, 2017
tkelman pushed a commit that referenced this issue Jun 3, 2017
fixes #22135, fixes #22122, fixes #22026, fixes #21581, fixes #16096, fixes #19351

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

No branches or pull requests

4 participants