JuliaLang / JuliaLang/JuliaSyntax.jl

Prohibit keywords for dot access.

Open
#526 1 comment 1 reaction 0 assignees View on GitHub
breaking syntax wat
Dominant language
Julia
Stars
293
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I ran into this real-world example:

```julia
function throw_default_branch_error(branches, cmd_succeeded)
branch_detail = if isempty(branches)
"none of DEFAULT_BRANCH_NAMES found"
else
"couldn't decide which of $branches is the default".
end
remote_detail = if cmd_succeeded
"git remote show origin didn't specify the a HEAD branch"
else
"remote show origin failed"
end
error("""
Unable to determine the default branch locally ($branch_detail).
Also unnable to determine the default branch by querying the remote ($remote_detail).
You can typically bypass this error by specifying the version manually (i.e. pass `-rev=...` to the CLI)
""")
end

end
```

```julia-repl
julia> throw_default_branch_error([], false)
"none of DEFAULT_BRANCH_NAMES found"
```

The issue is that `(;var"end"=5). end == 5` parses just fine and does not treat `end` as a keyword. Indeed keywords are accepted after `.` in all cases that I've checked. It would be a breaking/minor change to fix this. This is present in 1.6 and 1.11.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.