Fix variable name-collision guard to match updated JuMP error message - #97
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #96 (#96).
The test suite fails during "General tests" and "Variable creation" with:
Root cause
When building variables for a type hierarchy,
variables_elements(andvariables_element_ext_data) insrc/model.jlintentionally callvariables_elementfor a supertype and then again for its subtypes. To avoid double-registration of the same JuMP variable name, the call is wrapped in atry/catchthat silently continues when the raisedErrorExceptioncorresponds to an already-registered name.The guard matched the error text against the hardcoded substrings:
"An object of name""is already attached to this model."Newer JuMP (v1.31.1) changed the wording of the duplicate-registration error from
"is already attached to this model."to"is already registered in this model.". Because the second substring no longer matches, the exception was re-thrown instead of swallowed, aborting the model build.Changes
src/model.jl— the guards invariables_elementsandvariables_element_ext_datanow accept both message variants for cross-version compatibility.test/test_utils.jl— the "Variable creation" testset now asserts either message variant.0.10.5→0.10.6and added aNEWS.mdentry.Environment
Related