Skip to content

Commit 29dd842

Browse files
Merge pull request #3841 from AayushSabharwal/as/fix-mtkbuild
fix: fix @mtkbuild not working when @mtkcompile is not imported
2 parents 32b8bff + 0c6cf07 commit 29dd842

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/deprecations.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
macro mtkbuild(exprs...)
66
return quote
77
Base.depwarn("`@mtkbuild` is deprecated. Use `@mtkcompile` instead.", :mtkbuild)
8-
@mtkcompile $(exprs...)
8+
$(Expr(:macrocall, var"@mtkcompile",
9+
LineNumberNode(@__LINE__, @__FILE__), exprs...))
910
end |> esc
1011
end
1112

test/odesystem.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,3 +1615,12 @@ end
16151615
@test_nowarn push!(arr, sys)
16161616
@test_nowarn TestWrapper(sys)
16171617
end
1618+
1619+
# ensure `@mtkbuild` works when `@mtkcompile` is not imported
1620+
module MtkbuildTestModule
1621+
import ModelingToolkit: @variables, System, t_nounits as t, D_nounits as D, @mtkbuild
1622+
import Test: @test
1623+
@variables x(t)
1624+
@mtkbuild sys = System(D(x) ~ t, t)
1625+
@test sys isa System
1626+
end

0 commit comments

Comments
 (0)