Skip to content

fix minor convert_simplex method ambiguity #82

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

Merged
merged 1 commit into from
Aug 24, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/geometry_primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function convert_simplex(NFT::Type{NgonFace{N, T1}}, f::Union{NgonFace{N, T2}})
end

convert_simplex(NFT::Type{NgonFace{3,T}}, f::NgonFace{3,T2}) where {T, T2} = (convert(NFT, f),)
convert_simplex(NFT::Type{NgonFace{2,T}}, f::NgonFace{2,T2}) where {T, T2} = (convert(NFT, f),)

"""
convert_simplex(::Type{Face{3}}, f::Face{N})
Expand Down
9 changes: 9 additions & 0 deletions test/geometrytypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ NFace = NgonFace
LineFace{Int}(3,4),
LineFace{Int}(4,1)
)

@testset "NgonFace ambiguity" begin
face = NgonFace((1,2))
@test convert_simplex(NgonFace{2, UInt32}, face) === (NgonFace{2, UInt32}((1,2)),)
@test convert_simplex(typeof(face), face) === (face,)
face = NgonFace((1,))
@test convert_simplex(NgonFace{1, UInt32}, face) === (NgonFace{1, UInt32}((1,)),)
@test convert_simplex(typeof(face), face) === (face,)
end
end


Expand Down