GeometryBasics.jl
GeometryBasics.jl copied to clipboard
Construction from SVector is ambiguous
For example, Point2(SVector(1, 2)) throws:
MethodError: (GeometryBasics.Point2)(::StaticArraysCore.SVector{2, Int64}) is ambiguous.
Candidates:
(::Type{SV})(x::StaticArraysCore.StaticArray{Tuple{N}, T, 1} where {N, T}) where SV<:GeometryBasics.Point
@ GeometryBasics ~/.julia/packages/GeometryBasics/bLARu/src/fixed_arrays.jl:74
(GeometryBasics.Point{S})(x::AbstractVector{T}) where {S, T}
@ GeometryBasics ~/.julia/packages/GeometryBasics/bLARu/src/fixed_arrays.jl:34
(::Type{SA})(sa::StaticArraysCore.StaticArray) where SA<:StaticArraysCore.StaticArray
@ StaticArrays ~/.julia/packages/StaticArrays/EHHaF/src/convert.jl:170
(GeometryBasics.Point{S})(x::T) where {S, T}
@ GeometryBasics ~/.julia/packages/GeometryBasics/bLARu/src/fixed_arrays.jl:48
(T::Type{<:StaticArraysCore.StaticArray})(a::AbstractArray)
@ StaticArrays ~/.julia/packages/StaticArrays/EHHaF/src/convert.jl:174
Possible fix, define
(GeometryBasics.Point{S})(::StaticArraysCore.StaticArray{Tuple{N}, T, 1} where N) where {S, T}
Ah, I think this is because Point2 is also a subtype of StaticArray. We would probably need to define that dispatch in the macro which generates the point definitions.
In this case, the fix would be GB.Point{N}(::SArray{Tuple{N}, T, 1}) where N = ... or so. I've abbreviated a bit but it should make sense anyway...
Looks like this is resolved in v0.5:
julia> Point2(SVector(1, 2))
2-element Point{2, Int64} with indices SOneTo(2):
1
2