From ee2034d1124a224de8ad5c61c42d7e903477c00d Mon Sep 17 00:00:00 2001 From: Pepijn de Vos Date: Thu, 2 Nov 2023 18:39:19 +0100 Subject: [PATCH] Change typeof(x) <: y to x isa y --- src/common.jl | 8 ++++---- test/common.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common.jl b/src/common.jl index 2eb8d2e8b..2a502632b 100644 --- a/src/common.jl +++ b/src/common.jl @@ -7,7 +7,7 @@ function solve( saveat=eltype(tupType)[], reltol = 1e-5, abstol = 1e-8, save_everystep=isempty(saveat), dense = save_everystep && isempty(saveat), - save_start = save_everystep || isempty(saveat) || typeof(saveat) <: Number ? + save_start = save_everystep || isempty(saveat) || saveat isa Number ? true : prob.tspan[1] in saveat, callback=nothing, dtmin = abs(prob.tspan[2]-prob.tspan[1])/1e-9, @@ -20,8 +20,8 @@ function solve( if verbose warned = !isempty(kwargs) && check_keywords(alg, kwargs, warnlist) - if !(typeof(prob.f) <: DiffEqBase.AbstractParameterizedFunction) && - typeof(alg) <: ode23s + if !(prob.f isa DiffEqBase.AbstractParameterizedFunction) && + alg isa ode23s if DiffEqBase.has_tgrad(prob.f) @warn("Explicit t-gradient given to this stiff solver is ignored.") warned = true @@ -49,7 +49,7 @@ function solve( tspan = prob.tspan - if typeof(saveat) <: Number + if saveat isa Number if (tspan[1]:saveat:tspan[end])[end] == tspan[end] saveat_vec = convert(Vector{tType},collect(tType,tspan[1]+saveat:saveat:tspan[end])) else diff --git a/test/common.jl b/test/common.jl index 71a7cf67f..1f6b69307 100644 --- a/test/common.jl +++ b/test/common.jl @@ -12,7 +12,7 @@ prob = prob_ode_linear for alg in algs sol =solve(prob,alg;dt=dt,abstol=1e-6,reltol=1e-3) - @test typeof(sol[2]) <: Number + @test sol[2] isa Number end prob = prob_ode_2Dlinear