From 971b4c9c57121038b277d5e5ad869b22e4863645 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Thu, 30 Jul 2026 22:45:13 -0400 Subject: [PATCH] Use explicit `()` singleton variant syntax for clocks Moshi v0.3.11 deprecated the bare singleton variant syntax inside `@data`, so precompiling SciMLBase v2 emitted Warning: the bare singleton variant syntax `ContinuousClock` is deprecated, write `ContinuousClock()` instead (near .../src/clock.jl:4) Explicit `Name()` variants only parse on Moshi v0.3.11 or newer, so the compat floor moves with the syntax. Co-Authored-By: Chris Rackauckas --- Project.toml | 4 ++-- src/clock.jl | 4 ++-- test/clock.jl | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 1ac518a84..86d158453 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "SciMLBase" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.155.1" +version = "2.155.2" authors = ["Chris Rackauckas and contributors"] [deps] @@ -100,7 +100,7 @@ Markdown = "1.10" Measurements = "2" MonteCarloMeasurements = "1" Mooncake = "0.4, 0.5" -Moshi = "0.3.6" +Moshi = "0.3.11" PartialFunctions = "1.1" PreallocationTools = "0.4.31, 1.0" PrecompileTools = "1.2.1" diff --git a/src/clock.jl b/src/clock.jl index 3d2b01a29..e6c77c1db 100644 --- a/src/clock.jl +++ b/src/clock.jl @@ -1,12 +1,12 @@ abstract type AbstractClock end @data Clocks <: AbstractClock begin - ContinuousClock + ContinuousClock() struct PeriodicClock dt::Union{Nothing, Float64, Rational{Int}} phase::Float64 = 0.0 end - SolverStepClock + SolverStepClock() struct EventClock id::Symbol end diff --git a/test/clock.jl b/test/clock.jl index 7408eb86b..b8fa468d1 100644 --- a/test/clock.jl +++ b/test/clock.jl @@ -70,3 +70,17 @@ end @test clocktype(PeriodicClock(1 // 2, 3.14)) === (1 // 2, 3.14) @test clocktype(pi) === "other" broken = true end + +@testset "SciMLBase precompiles without deprecation warnings" begin + # Moshi's bare singleton variant syntax (`ContinuousClock` rather than + # `ContinuousClock()`) only warns while the `@data` block is macroexpanded, so a + # forced recompile is the only way to observe it from a test. + script = """Base.compilecache(Base.identify_package("SciMLBase"))""" + cmd = `$(Base.julia_cmd()) --startup-file=no --project=$(Base.active_project()) -e $script` + buf = IOBuffer() + run(pipeline(ignorestatus(cmd), stdout = buf, stderr = buf)) + output = String(take!(buf)) + occursin("deprecated", output) && + @info "SciMLBase precompilation output" output + @test !occursin("deprecated", output) +end