-
-
Notifications
You must be signed in to change notification settings - Fork 411
Description
_process_NL_expr gets called from the @NL macros, and doesn't have any type requirements:
Line 233 in 1e6b5d8
| function _process_NL_expr(model, ex) |
but it eventually calls a
_process_NL_expr_runtime which are restricted to ::Model.Line 181 in 1e6b5d8
| function _parse_NL_expr_runtime(m::Model, x::Real, tape, parent, values) |
Thus, someone (e.g., BilevelJuMP, x-ref: joaquimg/BilevelJuMP.jl#57) using this machinery with an <:AbstractModel encounters a MethodError:
https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681
We could either add a type-restriction to _process_NL_expr and have a fallback with an informative error message, or we could probably relax the type-restrictions, and see what happens. It probably means relaxing this as well to AbstractVariableRef:
Lines 187 to 188 in 1e6b5d8
| function _parse_NL_expr_runtime(m::Model, x::VariableRef, tape, parent, values) | |
| if owner_model(x) !== m |
cc @pulsipher who might be messing with this stuff