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: "..." expression outside call #23218

Closed
damiendr opened this issue Aug 11, 2017 · 0 comments
Closed

syntax: "..." expression outside call #23218

damiendr opened this issue Aug 11, 2017 · 0 comments
Assignees
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) kind:bug Indicates an unexpected problem or unintended behavior

Comments

@damiendr
Copy link
Contributor

damiendr commented Aug 11, 2017

Splatting a tuple inside of a tuple literal, and then destructuring the result confuses the parser:

julia> idx = (1,)
(1,)

julia> u = (idx...,)
(1,)

julia> (v,) = (idx...,)
ERROR: syntax: "..." expression outside call

julia> (v,) = tuple(idx...,)
(1,)

julia> (v,) = [idx...,]
1-element Array{Int64,1}:
 1

This trips up @fastmath in the following example:

julia> a = zeros(1); b = zeros(1);

julia> a[idx...] += b[idx...]
0.0

julia> @fastmath a[idx...] += b[idx...]
ERROR: syntax: "..." expression outside call

julia> macroexpand(:(@fastmath a[idx...] += b[idx...]))
quote  # fastmath.jl, line 109:
    ##685 = a # fastmath.jl, line 110:
    (##686,) = (idx...,) # fastmath.jl, line 111:
    ##685[##686] = Base.FastMath.add_fast(##685[##686], b[idx...])
end
@JeffBezanson JeffBezanson self-assigned this Aug 11, 2017
@ararslan ararslan added the parser Language parsing and surface syntax label Aug 11, 2017
@JeffBezanson JeffBezanson added compiler:lowering Syntax lowering (compiler front end, 2nd stage) kind:bug Indicates an unexpected problem or unintended behavior and removed parser Language parsing and surface syntax labels Aug 14, 2017
ararslan pushed a commit that referenced this issue Sep 11, 2017
ararslan pushed a commit that referenced this issue Sep 13, 2017
vtjnash pushed a commit that referenced this issue Sep 14, 2017
ararslan pushed a commit that referenced this issue Sep 15, 2017
ararslan pushed a commit that referenced this issue Sep 16, 2017
ararslan pushed a commit that referenced this issue Sep 18, 2017
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

3 participants