Skip to content

Prohibit keywords for dot access. #526

Open
@LilithHafner

Description

@LilithHafner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingsyntax watSyntax problem in the reference parser we may consider fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions