Skip to content
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

Fix method ambiguities #483

Merged
merged 8 commits into from
Apr 21, 2023
Merged

Fix method ambiguities #483

merged 8 commits into from
Apr 21, 2023

Conversation

devmotion
Copy link
Member

@devmotion devmotion commented Oct 17, 2022

Fixes #481.

I assume the only questionable change is that fixing the method ambiguity of map(t::Transform, ::AbstractVector), caused by map(::Tf, ::SparseVector) where {Tf} in SparseArrays, requires adding a dependency on SparseArrays.

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Patch coverage: 80.00% and project coverage change: -0.10 ⚠️

Comparison is base (9da7bfd) 94.25% compared to head (143c8b0) 94.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #483      +/-   ##
==========================================
- Coverage   94.25%   94.16%   -0.10%     
==========================================
  Files          52       52              
  Lines        1375     1387      +12     
==========================================
+ Hits         1296     1306      +10     
- Misses         79       81       +2     
Impacted Files Coverage Δ
src/chainrules.jl 87.65% <ø> (ø)
src/utils.jl 91.46% <50.00%> (ø)
src/transform/transform.jl 81.81% <75.00%> (-18.19%) ⬇️
src/kernels/overloads.jl 100.00% <100.00%> (ø)
src/transform/chaintransform.jl 81.48% <100.00%> (+1.48%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@devmotion
Copy link
Member Author

I assume the only questionable change is that fixing the method ambiguity of map(t::Transform, ::AbstractVector), caused by map(::Tf, ::SparseVector) where {Tf} in SparseArrays, requires adding a dependency on SparseArrays.

I guess it's even more questionable since actually it is not sufficient to fix the method ambiguities in the tests which load additional packages (see, e.g., https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/actions/runs/3268189406/jobs/5374299901#step:6:222 and https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/actions/runs/3268189406/jobs/5374301250#step:6:224):

   Evaluated: isempty(Tuple{Method, Method}[(map(f::Tf, A::SparseArrays.AbstractCompressedVector) where Tf @ SparseArrays.HigherOrderFns /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.9/SparseArrays/src/higherorderfns.jl:152, map(t::Transform, x::AbstractVector) @ KernelFunctions ~/work/KernelFunctions.jl/KernelFunctions.jl/src/transform/transform.jl:11), (map(f, A::NamedDims.NamedDimsArray) @ NamedDims ~/.julia/packages/NamedDims/kCxfn/src/functions.jl:157, map(t::Transform, x::AbstractVector) @ KernelFunctions ~/work/KernelFunctions.jl/KernelFunctions.jl/src/transform/transform.jl:11), (map(f, a1::StaticArraysCore.StaticArray, as::AbstractArray...) @ StaticArrays ~/.julia/packages/StaticArrays/PUoe1/src/mapreduce.jl:30, map(t::Transform, x::AbstractVector) @ KernelFunctions ~/work/KernelFunctions.jl/KernelFunctions.jl/src/transform/transform.jl:11), (map(f, As::AxisArray{T, N, D, Ax}...) where {T, N, D, Ax<:Tuple{Vararg{Axis}}} @ AxisArrays ~/.julia/packages/AxisArrays/v7vf4/src/core.jl:431, map(t::Transform, x::AbstractVector) @ KernelFunctions ~/work/KernelFunctions.jl/KernelFunctions.jl/src/transform/transform.jl:11), (map(f, A::AxisArray) @ AxisArrays ~/.julia/packages/AxisArrays/v7vf4/src/core.jl:422, map(t::Transform, x::AbstractVector) @ KernelFunctions ~/work/KernelFunctions.jl/KernelFunctions.jl/src/transform/transform.jl:11), (map(f::Tf, A::Union{SparseArrays.AbstractCompressedVector, SparseArrays.AbstractSparseMatrixCSC}, Bs::Vararg{Union{SparseArrays.AbstractCompressedVector, SparseArrays.AbstractSparseMatrixCSC}, N}) where {Tf, N} @ SparseArrays.HigherOrderFns /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.9/SparseArrays/src/higherorderfns.jl:156, map(t::Transform, x::AbstractVector) @ KernelFunctions ~/work/KernelFunctions.jl/KernelFunctions.jl/src/transform/transform.jl:11)])

@devmotion
Copy link
Member Author

So I am not sure if we can fix the map method ambiguity issues at all.

@theogf
Copy link
Member

theogf commented Apr 18, 2023

@devmotion Can we get this merged anyway (we can leave some ambiguities)

@theogf
Copy link
Member

theogf commented Apr 19, 2023

Lgtm when the tests are fixed

@devmotion
Copy link
Member Author

@theogf I managed to fix all method ambiguities by completely removing the definition of map(t::Transform, x::AbstractVector) (causes problems with basically every array package since they tend to implement map(f, x::MyArray)). Instead I only defined map(t::Transform, x::Union{ColVecs,RowVecs}).

@theogf theogf merged commit ef6d459 into master Apr 21, 2023
@theogf theogf deleted the dw/method_ambiguities branch April 21, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ambiguities
2 participants