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

propagate args as-is to convert_arguments(trait, args...) #3859

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ function convert_arguments(T::Type{<:AbstractPlot}, args...; kw...)
# Meaning, it needs to be a conversion trait, or it needs single_convert_arguments or expand_dimensions
CT = conversion_trait(T, args...)

# Try to expand dimensions first, as this is the most basic step!
expanded = expand_dimensions(CT, args...)
!isnothing(expanded) && return convert_arguments(T, expanded...; kw...)
# Try single argument convert after
arguments_converted = map(convert_single_argument, args)
if arguments_converted !== args
Expand Down
6 changes: 6 additions & 0 deletions test/convert_arguments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ end
@test_throws ArgumentError heatmap(1im)
end

# custom vector type to ensure that the conversion can be overriden for vectors
struct MyConvVector <: AbstractVector{Float64} end
Makie.convert_arguments(::PointBased, ::MyConvVector) = ([Point(10, 20)],)

@testset "convert_arguments" begin
#=
TODO:
Expand Down Expand Up @@ -227,6 +231,8 @@ end

@test apply_conversion(CT, m2) isa Tuple{Vector{Point2{T_out}}}
@test apply_conversion(CT, m3) isa Tuple{Vector{Point3{T_out}}}

@test apply_conversion(CT, MyConvVector()) == ([Point(10, 20)],)
end
end

Expand Down