JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl

more `test_approx` ambiguities

Open
#291 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
50
Forks
18
PR merge metrics
No merged PRs in 30d

Description

test_approx(Tangent{Float64}(), ZeroTangent())
test_approx(ZeroTangent(), Tangent{Float64}())

Fails due to method ambiguities.

ERROR: MethodError: test_approx(::Tangent{Float64, @NamedTuple{}}, ::ZeroTangent) is ambiguous.

Candidates:
  test_approx(actual::Tangent{P, T}, expected; ...) where {T, P}
    @ ChainRulesTestUtils /home/lweber/.julia/packages/ChainRulesTestUtils/Ko1Wr/src/check_result.jl:124
  test_approx(x, ::AbstractZero; ...)
    @ ChainRulesTestUtils /home/lweber/.julia/packages/ChainRulesTestUtils/Ko1Wr/src/check_result.jl:43

Possible fix, define
  test_approx(::Tangent{P, T}, ::AbstractZero) where {T, P}

Stacktrace:
 [1] top-level scope
   @ REPL[7]:1

The equivalent with NoTangent() works.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in check_result.jl around the test_approx methods at lines 43 and 124, then compare the Tangent and AbstractZero dispatch with the working NoTangent case. Confirm that both shown Tangent/ZeroTangent calls resolve without ambiguity and that the existing test suite still passes.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.