Skip to content

Commit 1b48f65

Browse files
committed
added depwarn to @submodel macro
1 parent 64b519d commit 1b48f65

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/submodel_macro.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ function prefix_submodel_context(prefix::Bool, ctx)
207207
return ctx
208208
end
209209

210+
const SUBMODEL_DEPWARN_MSG = "`@submodel model` is deprecated, use `@returned_quantities model` instead."
211+
210212
function submodel(prefix_expr, expr, ctx=esc(:__context__))
211213
prefix_left, prefix = getargs_assignment(prefix_expr)
212214
if prefix_left !== :prefix
@@ -225,6 +227,9 @@ function submodel(prefix_expr, expr, ctx=esc(:__context__))
225227
return if args_assign === nothing
226228
ctx = prefix_submodel_context(prefix, ctx)
227229
quote
230+
# Raise deprecation warning to let user know that we recommend using `@returned_quantities`.
231+
$(Base.depwarn)(SUBMODEL_DEPWARN_MSG, Symbol("@submodel"))
232+
228233
$retval, $(esc(:__varinfo__)) = $(_evaluate!!)(
229234
$(esc(expr)), $(esc(:__varinfo__)), $(ctx)
230235
)
@@ -241,6 +246,9 @@ function submodel(prefix_expr, expr, ctx=esc(:__context__))
241246
)
242247
end
243248
quote
249+
# Raise deprecation warning to let user know that we recommend using `@returned_quantities`.
250+
$(Base.depwarn)(SUBMODEL_DEPWARN_MSG, Symbol("@submodel"))
251+
244252
$retval, $(esc(:__varinfo__)) = $(_evaluate!!)(
245253
$(esc(R)), $(esc(:__varinfo__)), $(ctx)
246254
)

0 commit comments

Comments
 (0)