You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I found a small typo in the test of #21666, but it's curious that it hasn't lead to problems:
julia>using Base.Test
julia>struct F21666{T <:Base.TypeArithmetic}
x::Float32end
julia>@testset"Reduced exactness of cumsum # 21666"begin
Base.TypeArithmetic(::Type{F21666{T}}) where {T} = T # this should be T() I think
Base.:+(x::F, y::F) where {F <:F21666} =F(x.x + y.x)
Base.convert(::Type{Float64}, x::F21666) =Float64(x.x)
v =zeros(300)
cumsum(F21666{Base.ArithmeticRounds}.(v))
end
Test Summary:|
Reduced exactness of cumsum # 21666 | No tests
Base.Test.DefaultTestSet("Reduced exactness of cumsum # 21666", Any[], 0, false)
julia>@testset"Reduced exactness of cumsum # 21666"begin# try again
Base.TypeArithmetic(::Type{F21666{T}}) where {T} = T
Base.:+(x::F, y::F) where {F <:F21666} =F(x.x + y.x)
Base.convert(::Type{Float64}, x::F21666) =Float64(x.x)
v =zeros(300)
cumsum(F21666{Base.ArithmeticRounds}.(v))
end
Reduced exactness of cumsum # 21666: Error During Test
Got an exception of type MethodError outside of a @test
MethodError: no method matching _cumsum!(::Array{F21666{Base.ArithmeticRounds},1}, ::Array{F21666{Base.ArithmeticRounds},1}, ::Int64, ::Type{Base.ArithmeticRounds})
Closest candidates are:_cumsum!(::Any, ::Any, ::Any, ::Base.ArithmeticRounds) at multidimensional.jl:582_cumsum!(::Any, ::Any, ::Any, ::Base.ArithmeticUnknown) at multidimensional.jl:585_cumsum!(::Any, ::Any, ::Any, ::Base.TypeArithmetic) at multidimensional.jl:588
Stacktrace:
[1] macro expansion at ./REPL[10]:6 [inlined]
[2] macro expansion at ./test.jl:856 [inlined]
[3] anonymous at ./<missing>:?
[4] eval(::Module, ::Any) at ./boot.jl:235
[5] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[6] macro expansion at ./REPL.jl:97 [inlined]
[7] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
Test Summary:| Error Total
Reduced exactness of cumsum # 21666 | 1 1
ERROR: Some tests did not pass:0 passed, 0 failed, 1 errored, 0 broken.
The first time the @testset runs, the new method for Base.TypeArithmetic is ignored and the Base.ArithmeticUnknown() fallback is used. The second time the @testset runs, the new, faulty method for Base.TypeArithmetic is used leading to an error. It looks like the whole @testset runs in the same world - but that is not generally the case, is it?
BTW, I'd open a PR fixing the test, but I'm not sure whether the method definitions should be moved outside the @testset. They have global effect anyway, so it wouldn't hurt, but OTOH it's nice to have them in there just for grouping's sake.
The text was updated successfully, but these errors were encountered:
I think I found a small typo in the test of #21666, but it's curious that it hasn't lead to problems:
The first time the
@testset
runs, the new method forBase.TypeArithmetic
is ignored and theBase.ArithmeticUnknown()
fallback is used. The second time the@testset
runs, the new, faulty method forBase.TypeArithmetic
is used leading to an error. It looks like the whole@testset
runs in the same world - but that is not generally the case, is it?BTW, I'd open a PR fixing the test, but I'm not sure whether the method definitions should be moved outside the
@testset
. They have global effect anyway, so it wouldn't hurt, but OTOH it's nice to have them in there just for grouping's sake.The text was updated successfully, but these errors were encountered: