JuliaLang / JuliaLang/JuliaSyntax.jl

better error for begin-end in typed comprehension

Open
#504 3 comments 1 reaction 0 assignees View on GitHub
parser
Dominant language
Julia
Stars
293
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I ran across a small parsing error today for list comprehensions that use a begin-end block to compute the value. :)

This parses correctly:
```julia
julia> [ begin
i
end
for i in 1:3
]
3-element Vector{Int64}:
1
2
3

julia>
```

But this doesn't:
```julia
julia> Int[ begin
i
end
for i in 1:3
]
ERROR: syntax: unexpected "end"
Stacktrace:
[1] top-level scope
@ none:1

julia>
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the two Julia REPL examples and compare how typed comprehensions handle a begin-end value block with untyped comprehensions. Trace the parser's handling of the typed comprehension form; done means Int[begin ... end for i in 1:3] parses and evaluates like the untyped example.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.