Skip to content

Commit 1c3a98e

Browse files
committed
Update model.jl
1 parent 34b65ff commit 1c3a98e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/model.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ function generate_model_expression(backend, model_specification)
221221
ms_args_const_ids = Vector{Tuple{Symbol, Symbol}}()
222222

223223
ms_arg_expression_converter = (ms_arg) -> begin
224+
arg = nothing
225+
smth = nothing
224226
if @capture(ms_arg, arg_::ConstVariable = smth_) || @capture(ms_arg, arg_::ConstVariable)
225227
# rc_arg = gensym(:constvar)
226228
push!(ms_args_const_ids, (arg, arg)) # backward compatibility for old behaviour with gensym
@@ -235,6 +237,11 @@ function generate_model_expression(backend, model_specification)
235237
push!(ms_args_guard_ids, arg)
236238
push!(ms_args_ids, arg)
237239
return argument_write_default_value(arg, smth)
240+
elseif @capture(ms_arg, ::T_ = smth_) || @capture(ms_arg, ::T_)
241+
arg = gensym(:ms_arg)
242+
push!(ms_args_guard_ids, arg)
243+
push!(ms_args_ids, arg)
244+
return argument_write_default_value(:($(arg)::$(T)), smth)
238245
else
239246
error("Invalid argument specification: $(ms_arg)")
240247
end

0 commit comments

Comments
 (0)