-
Notifications
You must be signed in to change notification settings - Fork 99
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
Use tfill instead of fill in testvalue #360
Conversation
@@ -123,11 +123,11 @@ testvalue(::Type{T}) where T = zero(T) | |||
testvalue(v) = testvalue(typeof(v)) | |||
|
|||
function testvalue(::Type{T}) where T<:AbstractArray{E,N} where {E,N} | |||
similar(T,fill(0,N)...) | |||
similar(T,tfill(0,Val(N))...) |
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.
Val(N)
is still type-unstable (unless the compiler is able to leverage that N is a compiler constant here).
Use Val{N}()
instead.
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.
It is the same
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.
Since JuliaLang/julia#24362 and Julia 1.0, we don't need to be so careful.
end | ||
|
||
function testvalue(::Type{T}) where T<:Fill{E,N} where {E,N} | ||
Fill(zero(E),fill(0,N)...) | ||
Fill(zero(E),tfill(0,Val(N))...) |
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.
Idem
Let's wait to some clarifying answer in |
This PR makes
testvalue
type stable.