JuMP fails to throw an ERROR on an expr-model mismatch

Sometimes I build incorrect expressions obliviously, but JuMP won’t throw an ERROR. Is this good?

import JuMP, Gurobi
model1 = JuMP.Model(Gurobi.Optimizer);
JuMP.@variable(model1, x1 >= 1);
JuMP.@objective(model1, Min, x1);
JuMP.optimize!(model1);

model2 = JuMP.Model(Gurobi.Optimizer);
JuMP.@variable(model2, x2);
JuMP.@objective(model2, Min, x2);

# I miswrote `model2` as `model1` here
expr_miswrote = JuMP.@expression(model1, JuMP.value(x1)x2)
# But I fail to receive a proper ERROR
# And it can work normally later on!
JuMP.@constraint(model2, expr_miswrote >= 2)
JuMP.optimize!(model2)
JuMP.assert_is_solved_and_feasible(model2; allow_local = false)
@assert JuMP.objective_value(model2) == 2

Two unusual things to note:

  1. JuMP.value(x1)x2 belongs to model2 indeed, but it can be associated to model1.
  2. At least by inspecting the code, expr_miswrote belongs to model1, but it can be inserted into a model2’s constraint.