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

Prohibit keywords for dot access. #526

Open
LilithHafner opened this issue Jan 13, 2025 · 0 comments
Open

Prohibit keywords for dot access. #526

LilithHafner opened this issue Jan 13, 2025 · 0 comments
Labels
breaking syntax wat Syntax problem in the reference parser we may consider fixing

Comments

@LilithHafner
Copy link
Member

I ran into this real-world example:

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> 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.

@LilithHafner LilithHafner added breaking syntax wat Syntax problem in the reference parser we may consider fixing labels Jan 13, 2025
@LilithHafner LilithHafner changed the title Prohibit literal end for dot access. Prohibit keywords for dot access. Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking syntax wat Syntax problem in the reference parser we may consider fixing
Projects
None yet
Development

No branches or pull requests

1 participant