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

Syntax error when referencing Expr objects containing IR-specific content in the REPL #27546

Closed
jrevels opened this issue Jun 12, 2018 · 2 comments
Labels
kind:bug Indicates an unexpected problem or unintended behavior stdlib:REPL Julia's REPL (Read Eval Print Loop)

Comments

@jrevels
Copy link
Member

jrevels commented Jun 12, 2018

Might be REPL-only, haven't checked yet. EDIT: Yup, seems to be REPL-only.

Found while trying to update Cassette's reflection/IR pass code for the latest master:

julia> Expr(:call, GlobalRef(Base.Math, :float), Core.SlotNumber(2)) # broken
ERROR: syntax: Slot objects should not occur in an AST

julia> x = Any[Expr(:call, GlobalRef(Base.Math, :float), Core.SlotNumber(2))] # works
1-element Array{Any,1}:
 :((Base.Math.float)(_2))

julia> x[1] # broken
ERROR: syntax: Slot objects should not occur in an AST

julia> begin # works
           x = Expr(:call, GlobalRef(Base.Math, :float), Core.SlotNumber(2))
           y = Any[x]
           z = [y[1]]
       end
1-element Array{Expr,1}:
 :((Base.Math.float)(_2))
@jrevels jrevels changed the title Syntax error when referencing Expr objects containing IR-specific content Syntax error when referencing Expr objects containing IR-specific content in the REPL Jun 12, 2018
@jrevels jrevels added kind:bug Indicates an unexpected problem or unintended behavior stdlib:REPL Julia's REPL (Read Eval Print Loop) labels Jun 12, 2018
@JeffBezanson
Copy link
Sponsor Member

I think this is due to the REPL setting ans by calling eval on an expression containing the value. We could either use another mechanism there, or disable these errors inside QuoteNode.

@jrevels
Copy link
Member Author

jrevels commented Jun 18, 2018

Fixed by #27562

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior stdlib:REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

No branches or pull requests

2 participants