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

Destructed arguments cannot be properly used to define optional arguments #53832

Open
frankwswang opened this issue Mar 23, 2024 · 1 comment · May be fixed by #53851
Open

Destructed arguments cannot be properly used to define optional arguments #53832

frankwswang opened this issue Mar 23, 2024 · 1 comment · May be fixed by #53851
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@frankwswang
Copy link

MWE:

julia> f1(a::Tuple{T, T}, c::T=a[1]) where {T} = (a[1], c, a[2])
f1 (generic function with 2 methods)

julia> f2((a, b)::Tuple{T, T}, c::T=a) where {T} = (a, c, b)
f2 (generic function with 2 methods)

julia> f1((1, 2))
(1, 1, 2)

julia> f2((1, 2))
ERROR: UndefVarError: `a` not defined

System environment by versioninfo():

Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 20 × 12th Gen Intel(R) Core(TM) i9-12900HK
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 20 virtual cores)
@StefanKarpinski StefanKarpinski added bug Indicates an unexpected problem or unintended behavior parser Language parsing and surface syntax compiler:lowering Syntax lowering (compiler front end, 2nd stage) labels Mar 25, 2024
@StefanKarpinski
Copy link
Member

Definitely seems like a lowering bug. cc @JeffBezanson, @c42f

Keno added a commit that referenced this issue Mar 26, 2024
…ions

In case the default argument of some other argument makes use of the destructured
argument. Fixes #53832.
Keno added a commit that referenced this issue Mar 26, 2024
…ions

In case the default argument of some other argument makes use of the destructured
argument. Fixes #53832.
Keno added a commit that referenced this issue Mar 26, 2024
…ions

In case the default argument of some other argument makes use of the destructured
argument. Fixes #53832.
@Keno Keno removed the parser Language parsing and surface syntax label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants