JuliaLang / JuliaLang/JuliaSyntax.jl
better error for begin-end in typed comprehension
- 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