JuliaLang / JuliaLang/JuliaSyntax.jl
Parsing/Lowering of `t[i...; kw...]` fails
- Dominant language
- Julia
- Stars
- 293
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
If we define `Base.getindex(t::MyType, i...; kw...)` we can use the syntax `t[a=1]` and `t[1, a=1]` (they work as expected), but not `t[; a=1]` or `t[1; a=1]`, whose parsing or lowering fails
Demo:
```julia
julia> struct MyType end; Base.getindex(::MyType, i...; kw...) = (i, kw)
julia> t[; a=1]
ERROR: ParseError:
# Error @ REPL[1]:1:5
t[; a=1]
# └─┘ ── Expected `]`
Stacktrace:
[1] top-level scope
@ none:1
julia> t[1; a=1]
ERROR: syntax: misplaced assignment statement in "(t 1 (= a 1))" around REPL[2]:1
Stacktrace:
[1] top-level scope
@ REPL[2]:1
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.