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

function argument lowering inconsistency #37415

Open
simeonschaub opened this issue Sep 5, 2020 · 0 comments
Open

function argument lowering inconsistency #37415

simeonschaub opened this issue Sep 5, 2020 · 0 comments
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@simeonschaub
Copy link
Member

I don't think, this is actually a real problem, but it's a bit inconsistent that the following throws a syntax error:

julia> f(a, a[1]) = a
ERROR: syntax: "a[1]" is not a valid function argument name around REPL[16]:1
Stacktrace:
 [1] top-level scope
   @ REPL[16]:1

, whereas we allow this:

julia> f(a, (a[1],)) = a
f (generic function with 1 method)

julia> a = [1]
1-element Vector{Int64}:
 1

julia> f(a, 2)
1-element Vector{Int64}:
 2

julia> a
1-element Vector{Int64}:
 2

We could add a check for this when lowering destructed assignments, but it may not be worth it to bother.

@brenhinkeller brenhinkeller added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

No branches or pull requests

2 participants