-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
remove tuple indexing by non-integer #43760
Conversation
No reason not to have a deprecation. |
Isn't this behaviour confusing though? julia> key = 1.0;
julia> haskey((1,), key)
true
julia> (1,)[key]
ERROR Relevant #42679 |
Uhoh |
We should probably just fix |
I don't really have a dog in this fight, but I believe the only real way to fix this is by reverting #42679. The logic behind #42679 is simply flawed - The problem in this PR is not limited to arrays and tuples. As long as #42679 is not reverted, it will appear whenever one of these two situations happen
And these edge cases are endless - it's very easy to make a new type where one of the two situations above happen. |
From triage: let's run pkgeval and plan to put in a deprecation for this. We should also revert #42679 (it's not in 1.7, so no big deal). |
@vtjnash anything else to do here (other than run nanosoldier? |
I just remembered that pkgeval isn't needed because I ended up deprecating rather than removing the "feature" |
new tests are failing:
once fixed, this LGTM |
@JeffBezanson can you look at the build error here? I don't understand why it's not working. |
The |
This will give worse source information though? Why doesn't the macro work? |
I haven't managed to figure out a way to combine |
Why do you need to use
and gives
|
The problem is that changes the type of error of |
No?
|
huh, not sure what was happening then. Let's retry CI |
Probably the tests run with |
oh. That's it. I'll change the test. |
Can we merge this now? (Windows CI failure is unrelated, will be fixed by #44097) |
test/tuple.jl
Outdated
@test_deprecated getindex((1,), 1.0) === 1 | ||
@test_deprecated getindex((1,2), 2.0) === 2 | ||
@test_throws Exception getindex((), 1.0) | ||
@test_throws Exception getindex((1,2), 0.0) | ||
@test_throws Exception getindex((1,2), -1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably these should be moved to https://github.com/JuliaLang/julia/blob/master/test/deprecation_exec.jl (which doesn't run with --depwarn=error
).
49057c3
to
caeec48
Compare
Co-authored-by: Fredrik Ekre <[email protected]>
I feel lucky
Co-authored-by: Simeon Schaub <[email protected]>
caeec48
to
dfb5393
Compare
Co-authored-by: Fredrik Ekre <[email protected]> Co-authored-by: Simeon Schaub <[email protected]>
Co-authored-by: Fredrik Ekre <[email protected]> Co-authored-by: Simeon Schaub <[email protected]>
Co-authored-by: Fredrik Ekre <[email protected]> Co-authored-by: Simeon Schaub <[email protected]>
Currently we don't throw an error for
(1,2)[1.0]
even though we really should. I'd be open to making this a deprectation warning rather than an error, if people think this might break actual people's code.