@@ -207,6 +207,8 @@ function prefix_submodel_context(prefix::Bool, ctx)
207207 return ctx
208208end
209209
210+ const SUBMODEL_DEPWARN_MSG = " `@submodel model` is deprecated, use `@returned_quantities model` instead."
211+
210212function 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