|
1 | | -using SymbolicAnalysis, Aqua, JET, Test |
| 1 | +using SymbolicAnalysis, Aqua, JET, SciMLTesting |
2 | 2 |
|
3 | | -@testset "Aqua" begin |
4 | | - Aqua.test_all(SymbolicAnalysis) |
5 | | -end |
| 3 | +const SA = SymbolicAnalysis |
6 | 4 |
|
7 | | -@testset "JET" begin |
8 | | - JET.test_package(SymbolicAnalysis; target_defined_modules = true) |
9 | | -end |
| 5 | +# Functions this package deliberately extends with symbolic-analysis methods. |
| 6 | +# Registering DCP/GDCP methods on these non-owned functions (and the Symbolics |
| 7 | +# traversal/symtype hooks) is the core purpose of the package, so they are |
| 8 | +# intentional and declared to Aqua's piracy check via `treat_as_own`. |
| 9 | +const SYMBOLIC_OWN = Any[ |
| 10 | + Base.log, SA.LinearAlgebra.tr, SA.LinearAlgebra.inv, SA.LinearAlgebra.sqrt, |
| 11 | + SA.LinearAlgebra.logdet, SA.Manifolds.distance, SA.LogExpFunctions.xlogx, |
| 12 | + SA.Symbolics.arguments, SA.Symbolics.hasmetadata, SA.Symbolics.promote_symtype, |
| 13 | +] |
| 14 | + |
| 15 | +# The scalar/array `@register_symbolic`/`@register_array_symbolic` registrations |
| 16 | +# for the package's own atoms generate overlapping signatures (e.g. a scalar and |
| 17 | +# an array method of the same atom), which Aqua reports as internal ambiguities. |
| 18 | +# These are all between SymbolicAnalysis's own methods (no cross-package |
| 19 | +# ambiguity remains) and are benign; concrete calls dispatch unambiguously. |
| 20 | +# Excluding only these atoms keeps the check live for everything else. |
| 21 | +const ATOM_AMBIGUITIES = Any[ |
| 22 | + SA.affine_map, SA.sdivergence, SA.lorentz_least_squares, SA.conjugation, |
| 23 | + SA.log_quad_form, SA.lorentz_homogeneous_quadratic, SA.hadamard_product, |
| 24 | + SA.lorentz_homogeneous_diagonal, SA.lorentz_transform, SA.quad_over_lin, |
| 25 | +] |
| 26 | + |
| 27 | +run_qa( |
| 28 | + SymbolicAnalysis; |
| 29 | + Aqua = Aqua, |
| 30 | + JET = JET, |
| 31 | + jet = true, |
| 32 | + aqua_kwargs = (; |
| 33 | + ambiguities = (; exclude = ATOM_AMBIGUITIES), |
| 34 | + piracies = (; treat_as_own = SYMBOLIC_OWN), |
| 35 | + ), |
| 36 | + jet_kwargs = (; target_modules = (SymbolicAnalysis,), mode = :typo), |
| 37 | +) |
0 commit comments