diff --git a/src/deprecations.jl b/src/deprecations.jl index 6e8ea23b1c..d5e044801a 100644 --- a/src/deprecations.jl +++ b/src/deprecations.jl @@ -5,7 +5,8 @@ macro mtkbuild(exprs...) return quote Base.depwarn("`@mtkbuild` is deprecated. Use `@mtkcompile` instead.", :mtkbuild) - @mtkcompile $(exprs...) + $(Expr(:macrocall, var"@mtkcompile", + LineNumberNode(@__LINE__, @__FILE__), exprs...)) end |> esc end diff --git a/test/odesystem.jl b/test/odesystem.jl index 2e3bca34e2..438e5e7c10 100644 --- a/test/odesystem.jl +++ b/test/odesystem.jl @@ -1615,3 +1615,12 @@ end @test_nowarn push!(arr, sys) @test_nowarn TestWrapper(sys) end + +# ensure `@mtkbuild` works when `@mtkcompile` is not imported +module MtkbuildTestModule +import ModelingToolkit: @variables, System, t_nounits as t, D_nounits as D, @mtkbuild +import Test: @test +@variables x(t) +@mtkbuild sys = System(D(x) ~ t, t) +@test sys isa System +end