-
-
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
presently possible rewrites for potential collect deprecation #25450
Conversation
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.
Thanks! Looks good, though I've noted a few places where Vector
could be removed.
test/abstractarray.jl
Outdated
@@ -791,7 +791,7 @@ for A in (rand(2), rand(2,3)) | |||
for (i, v) in pairs(A) | |||
@test A[i] == v | |||
end | |||
@test collect(values(A)) == collect(A) | |||
@test Array(values(A)) == Array(A) |
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.
Array
doesn't seem needed on the RHS?
test/arrayops.jl
Outdated
@@ -468,7 +468,7 @@ end | |||
@test find(c -> c == 'l', s) == [3] | |||
g = Base.Unicode.graphemes("日本語") | |||
@test find(isascii, g) == Int[] | |||
@test find(!iszero, (i % 2 for i in 1:10)) == collect(1:2:9) | |||
@test find(!iszero, (i % 2 for i in 1:10)) == Vector(1:2:9) |
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.
Vector
shouldn't be needed now.
test/arrayops.jl
Outdated
@@ -1631,7 +1631,7 @@ end | |||
val, state = next(itr, state) | |||
@test done(itr, state) | |||
@test r[val] == 3 | |||
r = sparse(collect(2:3:8)) | |||
r = sparse(Vector(2:3:8)) |
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.
Vector
doesn't seem to be needed.
test/offsetarray.jl
Outdated
gv = view(g, -1:2) | ||
@test axes(gv, 1) === Base.OneTo(4) | ||
@test collect(gv) == collect(-1:2) | ||
@test collect(gv) == Vector(-1:2) |
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.
Not needed here not below.
test/random.jl
Outdated
@test shuffle(mta,collect(1:10)) == shuffle(mtb,collect(1:10)) | ||
@test shuffle!(mta,collect(1:10)) == shuffle!(mtb,collect(1:10)) | ||
@test shuffle(mta,collect(2:11)) == shuffle(mtb,2:11) | ||
@test shuffle(mta,Vector(1:10)) == shuffle(mtb,collect(1:10)) |
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.
Also change collect
on the RHS.
test/sparse/sparse.jl
Outdated
@@ -1864,7 +1864,7 @@ end | |||
# are called. (Issue #18705.) EDIT: #19239 unified broadcast over a single sparse matrix, | |||
# eliminating the former operation classes. | |||
@testset "issue #18705" begin | |||
S = sparse(Diagonal(collect(1.0:5.0))) | |||
S = sparse(Diagonal(Vector(1.0:5.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.
Vector
not needed, nor below.
test/statistics.jl
Outdated
@test quantile(100.0:-1.0:0.0, 0.0:0.1:1.0) == collect(0.0:10.0:100.0) | ||
@test quantile(0.0:100.0, 0.0:0.1:1.0, sorted=true) == collect(0.0:10.0:100.0) | ||
@test quantile(100f0:-1f0:0.0, 0.0:0.1:1.0) == collect(0f0:10f0:100f0) | ||
@test quantile(100.0:-1.0:0.0, 0.0:0.1:1.0) == Vector(0.0:10.0:100.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.
Vector
not needed.
Thanks for the thorough review @nalimilan! Comments addressed :). |
I'm still a little bit worried about #16029 (comment). Is the idea that we've made a stronger distinction between |
@JeffBezanson: can you clarify the new relationship between |
The differences between
So it is still the case that constructors have more leeway than |
(Marking triage for a decision re. #16029 (comment) / this pull request. Best!) |
I think these changes are meaningful even if |
After reviewing these changes again, I tend to agree :). So absent objections or requests for time, I plan to merge these changes tomorrow midday PT or later. Best! |
(AV i686 timed out without apparent issue prior, Travis i686 hit an unrelated libgit2 failure without other apparent issues, and Travis macOS hit an unrelated spawn failure without other apparent issues.) |
Thanks all! :) |
presently possible rewrites for potential collect deprecation
This pull request rewrites (all?)
collect
calls that can presently be rewritten asVector
|Matrix
|Array
, constituting a head start on the potentialcollect
deprecation between 0.7 and 1.0. (For the latest re. the potentialcollect
deprecation, ref. #16029 (comment).) Best!