Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lowering: Disallow splatting in non-final default value
Pop quiz: Do you know what the following will do? ``` julia> function g1(a=(1,2)..., b...=3) b end julia> g1() julia> function g2(a=(1,2)..., b=3, c=4) (b, c) end julia> g2() julia> function g3(a=(1,2)..., b=3, c...=4) (b, c) end julia> g3() julia> g3(1) ``` I don't either and I don't think it's particularly well defined. Splatting a default argument makes sense on the last argument, which can be a vararg, and it is desirable to be able to specify the default for the whole varargs tuple at once (although arguably that should just be the non-`...` behavior, but that'd be too breaking a change). Ref #50518. However, for other arguments, there isn't really a sensible semantic meaning. This PR disallows this in lowering. This is technically a minor change, but I doubt anybody is using this. Splatting in default values wasn't really ever supposed to work anyway, it just happened to fall out of our lowering.
- Loading branch information