diff --git a/Project.toml b/Project.toml index e013314..eedca3e 100644 --- a/Project.toml +++ b/Project.toml @@ -29,6 +29,7 @@ CircularArrays = "1" ComplexValues = "0.3" Dierckx = "0.5" ForwardDiff = "1" +JET = "0.9, 0.10" LinearAlgebra = "1" Makie = "0.24" Plots = "1" @@ -41,8 +42,9 @@ julia = "1" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "Statistics", "Aqua"] +test = ["Test", "Statistics", "Aqua", "JET"] diff --git a/src/discretize.jl b/src/discretize.jl index 6dfe727..8c57c2a 100644 --- a/src/discretize.jl +++ b/src/discretize.jl @@ -9,6 +9,7 @@ end function refine_discretization(p::AbstractCurveOrPath, lims::AbstractVector, ds::Real) t = collect(range(lims[1], lims[2], 20)) + z = p.(t) idx = [1] while length(idx) > 0 z = p.(t) @@ -205,7 +206,7 @@ function discretize(E::ExteriorRegion, n::Integer=600) r *= 4//3 xlims = mean(xlims) .+ (-r, r) ylims = mean(ylims) .+ (-r, r) - return discretize(ConnectedRegion(nothing, E.inner), n, limits=(xlims..., ylims...)) + return invoke(discretize, Tuple{AbstractConnectedRegion,Any}, E, n; limits=(xlims..., ylims...)) end # Utility function for the main calls. diff --git a/src/polygons.jl b/src/polygons.jl index 06a4214..dedbf84 100644 --- a/src/polygons.jl +++ b/src/polygons.jl @@ -335,7 +335,7 @@ inv(r::Rectangle) = inv(Polygon(r)) # these provide shortcuts Base.:+(r::Rectangle, z::Number) = Rectangle(r.center + z, r.radii, r.rotation) Base.:+(z::Number, r::Rectangle) = r + z -Base.:-(r::Rectangle) = rectangle(-verices(r)) +Base.:-(r::Rectangle) = rectangle(-vertices(r)) Base.:-(r::Rectangle, z::Number) = Rectangle(r.center - z, r.radii, r.rotation) Base.:-(z::Number, r::Rectangle) = (-r) + z diff --git a/test/runtests.jl b/test/runtests.jl index 5acb082..7e95523 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,11 +5,23 @@ check(u::AbstractArray, v::AbstractArray) = all(check(u, v) for (u, v) in zip(u, check(u::AbstractArray, v::Number) = all(check(u, v) for u in u) using Test using Aqua +using JET @testset "Aqua quality assurance" begin Aqua.test_all(ComplexRegions) end +@testset "JET static analysis" begin + # Informational only: run JET's static analysis and report findings without + # failing the suite. Inference-limitation false positives (which work via + # runtime dispatch) can appear depending on the Julia version, so this is a + # non-blocking heads-up rather than a hard gate. + rep = report_package(ComplexRegions; target_modules=(ComplexRegions,)) + n = length(JET.get_reports(rep)) + n > 0 && @warn "JET reported $n possible issue(s) (informational; see output above)." + @test true +end + @testset "Utilities" begin @test CR.scaleto(1im, 3im, [0.5, 0.75]) ≈ [2.0im, 2.5im] @test CR.scalefrom(1im, 3im, [2im, 1im, 1.5im]) ≈ [0.5, 0, 0.25]