fix: propagate __options__ to child Context for multi-/named-output submodels - #316
Open
docxology wants to merge 1 commit into
Open
fix: propagate __options__ to child Context for multi-/named-output submodels#316docxology wants to merge 1 commit into
__options__ to child Context for multi-/named-output submodels#316docxology wants to merge 1 commit into
Conversation
…bmodels
Inline where { constraints = ... } (and other context options) were silently
dropped for multi-output and named-output submodel calls because the generated
make_node! built the child Context without NodeCreationOptions. Mirror the
single-output path.
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.
Description
Fixes #1. When a composite submodel is called with a multi-output (
(a, b) ~ sub(...)) ornamed-output (
(a = x, b = y) ~ sub(...)) left-hand side, the generatedmake_node!built the child
Contextwithout theNodeCreationOptionsfrom thewhere { ... }clause.The single-output path already passes it. As a result inline
where { constraints = ... }(and any compound-context option) was silently ignored for those submodels.
Change
src/model_macro.jl— in both generated compositemake_node!bodies:(Tuple-LHS path, previously line ~860; NamedTuple-LHS path, previously line ~882.)
Tests
Added a regression test in
test/plugins/variational_constraints/variational_constraints_tests.jlasserting that a multi-output submodel call with
where { constraints = ... }exposes theexpected
Constraintsviaget(context_options(inner_context), :constraints, nothing)andmaterializes the requested factorization — mirroring the existing single-output
"inline constraints on submodel calls" test.
Verification
test/plugins/variational_constraints/variational_constraints_tests.jl: passtest/multi_and_zero_output_tests.jl: pass