You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug 🐞
The @mtkmodel macro expands to code which relies on certain names beeing presend in the calling context, for example Num and Equation. As of #3526 also System (see this line)
This is breaking in contexts which use only implicit imports, for example I hadn't imported System before. I guess everything should be called via ModelingToolkit.$sym? But in general you cannot even assume that ModelingToolkit is defined in the calling module...
Expected behavior
Only depend on using Modelingtoolkit: @mtkmodel to use @mtkmodel macro.
Minimal Reproducible Example 👇
using ModelingToolkit: ModelingToolkit, @mtkmodel, @variables, @parameters, t_nounits as t # those kinda make senseusing ModelingToolkit: Equation, Num, System # <- this is needed@mtkmodel MyModel begin@variablesbeginx(t)
y(t)
end@parametersbegin
a
end@equationsbegin
y ~ a * x
endendMyModel(; name=:foo)
The text was updated successfully, but these errors were encountered:
Describe the bug 🐞
The
@mtkmodel
macro expands to code which relies on certain names beeing presend in the calling context, for exampleNum
andEquation
. As of #3526 alsoSystem
(see this line)This is breaking in contexts which use only implicit imports, for example I hadn't imported
System
before. I guess everything should be called viaModelingToolkit.$sym
? But in general you cannot even assume thatModelingToolkit
is defined in the calling module...Expected behavior
Only depend on
using Modelingtoolkit: @mtkmodel
to use@mtkmodel
macro.Minimal Reproducible Example 👇
The text was updated successfully, but these errors were encountered: