Skip to content

Commit 1b64bac

Browse files
fix: fix potential Julia compilation bug on 1.10
1 parent ba589e5 commit 1b64bac

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/ModelingToolkitBase/src/ModelingToolkitBase.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,18 @@ function __init__()
358358
SU.hashcons(COMMON_TRUE, true)
359359
SU.hashcons(COMMON_FALSE, true)
360360
SU.hashcons(COMMON_SENTINEL, true)
361-
return SU.hashcons(COMMON_INF, true)
361+
SU.hashcons(COMMON_INF, true)
362+
# Workaround for Julia 1.10 compiler bug
363+
# See https://github.com/SciML/ModelingToolkit.jl/issues/4211
364+
@static if VERSION < v"1.11"
365+
# Force collect_var! compilation to fix collect_vars!
366+
@variables _dummy_t
367+
@parameters _dummy_p
368+
@variables _dummy_x(_dummy_t) = _dummy_p
369+
_us = OrderedSet{SymbolicT}()
370+
_ps = OrderedSet{SymbolicT}()
371+
collect_var!(_us, _ps, unwrap(_dummy_x), unwrap(_dummy_t); depth=0)
372+
end
362373
end
363374

364375
include("precompile.jl")

0 commit comments

Comments
 (0)