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

Unexpected parse error for Macrocall inside function call syntax. #50446

Open
NHDaly opened this issue Jul 6, 2023 · 1 comment
Open

Unexpected parse error for Macrocall inside function call syntax. #50446

NHDaly opened this issue Jul 6, 2023 · 1 comment
Labels
parser Language parsing and surface syntax

Comments

@NHDaly
Copy link
Member

NHDaly commented Jul 6, 2023

Looks like a similar case to #18650.

julia> wait(@async 2+2)

julia> (@async for i in 1:10 end)
Task (done) @0x000000017a6a33d0

julia> wait(@async for i in 1:10 end)  # <-- this seems like it should work
ERROR: syntax: unexpected "end"
Stacktrace:
 [1] top-level scope
   @ none:1

julia> wait((@async for i in 1:10 end))  # <-- same here
ERROR: syntax: expected ")"
Stacktrace:
 [1] top-level scope
   @ none:1

julia> @sync @async for i in 1:10 end
Task (done) @0x000000017a5cc180

julia> wait(@async(for i in 1:10 end))
@NHDaly NHDaly added the parser Language parsing and surface syntax label Jul 6, 2023
@Seelengrab
Copy link
Contributor

Seelengrab commented Jul 7, 2023

For context, JuliaSyntax/1.10-DEV reports this:

julia> wait(@async for i in 1:10 end) 
ERROR: ParseError:
# Error @ REPL[1]:1:27
wait(@async for i in 1:10 end) 
#                         └ ── Expected `)`
# Error @ REPL[1]:1:27
wait(@async for i in 1:10 end) 
#                         └──┘ ── extra tokens after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

julia> wait((@async for i in 1:10 end))
ERROR: ParseError:
# Error @ REPL[2]:1:28
wait((@async for i in 1:10 end))
#                          └ ── Expected `)`
# Error @ REPL[2]:1:28
wait((@async for i in 1:10 end))
#                          └ ── Expected `)`
# Error @ REPL[2]:1:28
wait((@async for i in 1:10 end))
#                          └───┘ ── extra tokens after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

So while the new and old parser are consistent here, they still erronously close the block/expression too soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

2 participants