Skip to content

Ambiguous NgonFace constructors #151

Open
@lhupe

Description

@lhupe

Constructing a NgonFace from an SVector fails because of ambiguity: StaticArrays defines some conversion constructors, which interfere with the NgonFace constructors because NgonFace <: StaticVector

MWE

using GeometryBasic, StaticArrays
t = TriangleFace(SA[0.4, 0.2, 0.55])

results in

ERROR: MethodError: (TriangleFace{T} where T)(::SVector{3, Float64}) is ambiguous. Candidates:
  (::Type{SV})(x::StaticVector{N, T} where {N, T}) where SV<:NgonFace in GeometryBasics at /home/$USER/.julia/packages/GeometryBasics/WMp6v/src/fixed_arrays.jl:74
  (::Type{SA})(a::StaticArray) where SA<:StaticArray in StaticArrays at /home/$USER/.julia/packages/StaticArrays/vxjOO/src/convert.jl:5
  (NgonFace{S, T} where T)(x::AbstractVector{T}) where {S, T} in GeometryBasics at /home/$USER/.julia/packages/GeometryBasics/WMp6v/src/fixed_arrays.jl:34
  (::Type{SA})(a::AbstractArray) where SA<:StaticArray in StaticArrays at /home/$USER/.julia/packages/StaticArrays/vxjOO/src/convert.jl:7
  (NgonFace{S, T} where T)(x::T) where {S, T} in GeometryBasics at /home/$USER/.julia/packages/GeometryBasics/WMp6v/src/fixed_arrays.jl:48
Possible fix, define
  (NgonFace{S, T} where T)(::StaticVector{N, T} where N) where {S, T}
Stacktrace:
 [1] top-level scope
   @ REPL[4]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions