JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
`test_approx` has ambiguities
Open
Nobody has claimed this yet.
bug
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
julia> ChainRulesTestUtils.test_approx(Tangent{Int}(; x=1), ZeroTangent())
ERROR: MethodError: test_approx(::Tangent{Int64, NamedTuple{(:x,), Tuple{Int64}}}, ::ZeroTangent) is ambiguous. Candidates:
test_approx(x, ::AbstractZero) in ChainRulesTestUtils at /Users/me/.julia/packages/ChainRulesTestUtils/8dFTY/src/check_result.jl:34
test_approx(actual::Tangent{P, T}, expected) where {T, P} in ChainRulesTestUtils at /Users/me/.julia/packages/ChainRulesTestUtils/8dFTY/src/check_result.jl:108
Possible fix, define
test_approx(::Tangent{P, T}, ::AbstractZero) where {T, P}
Stacktrace:
That's a made-up example, the real one gave:
Error During Test at /Users/me/.julia/packages/ChainRulesTestUtils/8dFTY/src/testers.jl:195
Got exception outside of a @test
MethodError: (::ChainRulesTestUtils.var"#test_approx##kw")(::NamedTuple{(:rtol, :atol), Tuple{Float64, Float64}}, ::typeof(test_approx), ::ChainRulesCore.NoTangent, ::ChainRulesCore.Tangent{Tuple{Float64, Float64, Float64}, Tuple{Float64, Float64, Float64}}) is ambiguous. Candidates:
(var"#s103"::ChainRulesTestUtils.var"#test_approx##kw")(::Any, ::typeof(test_approx), x, y::ChainRulesCore.Tangent) in ChainRulesTestUtils at /Users/me/.julia/packages/ChainRulesTestUtils/8dFTY/src/check_result.jl:124
(var"#s102"::ChainRulesTestUtils.var"#test_approx##kw")(::Any, ::typeof(test_approx), ::ChainRulesCore.AbstractZero, x) in ChainRulesTestUtils at /Users/me/.julia/packages/ChainRulesTestUtils/8dFTY/src/check_result.jl:33
Possible fix, define
(::ChainRulesTestUtils.var"#test_approx##kw")(::Any, ::typeof(test_approx), ::ChainRulesCore.AbstractZero, ::ChainRulesCore.Tangent)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/check_result.jl at the test_approx methods around lines 33, 34, 108, and 124, then review the failure reported from src/testers.jl:195. Reproduce the ambiguous dispatch shown in the issue and make the overlapping AbstractZero/Tangent case unambiguous. Done means the reported examples no longer raise a MethodError and the existing tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100