diff --git a/src/NonlinearSolve.jl b/src/NonlinearSolve.jl index 305d9e5aa..2719a5c56 100644 --- a/src/NonlinearSolve.jl +++ b/src/NonlinearSolve.jl @@ -38,13 +38,20 @@ import SnoopPrecompile SnoopPrecompile.@precompile_all_calls begin for T in (Float32, Float64) prob = NonlinearProblem{false}((u, p) -> u .* u .- p, T(0.1), T(2)) - for alg in (NewtonRaphson,) - solve(prob, alg(), abstol = T(1e-2)) + + precompile_algs = if VERSION >= v"1.7" + (NewtonRaphson(), TrustRegion()) + else + (NewtonRaphson(),) + end + + for alg in precompile_algs + solve(prob, alg, abstol = T(1e-2)) end prob = NonlinearProblem{true}((du, u, p) -> du[1] = u[1] * u[1] - p[1], T[0.1], T[2]) - for alg in (NewtonRaphson,) - solve(prob, alg(), abstol = T(1e-2)) + for alg in precompile_algs + solve(prob, alg, abstol = T(1e-2)) end end end