JuliaPolyhedra / Polyhedra.jl

Polyhedral Computation Interface
Other
172 stars 27 forks source link

New ambiguity in Julia 1.3 #187

Closed KristofferC closed 5 years ago

KristofferC commented 5 years ago

While running the package tests for the upcoming 1.3, a new ambiguity in "HybridSystems.jl" was detected but it seems to originate from this package:

Switched System: Error During Test at /root/.julia/packages/HybridSystems/Ym91d/test/runtests.jl:8
  Got exception outside of a @test
  MethodError: convexhull(::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}) is ambiguous. Candidates:
    convexhull(ps::AbstractArray{T,1} where T...) in Polyhedra at /root/.julia/packages/Polyhedra/opCEk/src/repop.jl:67
    convexhull(p1::Union{AbstractArray{T,1}, Polyhedron{T}, VRepresentation{T}, Union{Line{T,AT}, Ray{T,AT}} where AT}, p2::Union{AbstractArray{T,1}, Polyhedron{T}, VRepresentation{T}, Union{Line{T,AT}, Ray{T,AT}} where AT}, ps::Union{AbstractArray{T,1}, Polyhedron{T}, VRepresentation{T}, Union{Line{T,AT}, Ray{T,AT}} where AT}...) where T in Polyhedra at /root/.julia/packages/Polyhedra/opCEk/src/repop.jl:74
    convexhull(ps::AbstractArray{T,1} where T...) in Polyhedra at /root/.julia/packages/Polyhedra/opCEk/src/repop.jl:67
  Possible fix, define
    convexhull(::Vararg{AbstractArray{T,1} where T,N} where N)

We believe this is a real ambiguity that got detected due to improvements in the Julia type system and thus needs to be fixed in this package.

schillic commented 5 years ago

Here is another one for v1.3-rc2:

julia> using Polyhedra

julia> P = vrep([[0.0, 0.0]], d=2);

julia> Q = polyhedron(P);

julia> intersect(Q, Q)
ERROR: MethodError: intersect(::DefaultPolyhedron{Float64,Polyhedra.Intersection{Float64,Array{Float64,1},Int64},Polyhedra.Hull{Float64,Array{Float64,1},Int64}}, ::DefaultPolyhedron{Float64,Polyhedra.Intersection{Float64,Array{Float64,1},Int64},Polyhedra.Hull{Float64,Array{Float64,1},Int64}}) is ambiguous. Candidates:
  intersect(p::Union{HRepresentation{T}, Polyhedron{T}} where T...) in Polyhedra at /Polyhedra/opCEk/src/repop.jl:19
  intersect(p1::Union{HRepresentation{T}, Polyhedron{T}, HRepElement{T,AT} where AT}, p2::Union{HRepresentation{T}, Polyhedron{T}, HRepElement{T,AT} where AT}, ps::Union{HRepresentation{T}, Polyhedron{T}, HRepElement{T,AT} where AT}...) where T in Polyhedra at /Polyhedra/opCEk/src/repop.jl:29
Possible fix, define
  intersect(::Vararg{Union{HRepresentation{T}, Polyhedron{T}} where T,N} where N)
blegat commented 5 years ago

@KristofferC Isn't it weird that the first and third method in https://github.com/JuliaPolyhedra/Polyhedra.jl/issues/187#issue-496186287 are exactly the same ?

KristofferC commented 5 years ago

Yes, see https://github.com/JuliaLang/julia/issues/33166.