Skip to content

DSL: allow dotted references in interpolated rates - #1565

Merged
TorkelE merged 1 commit into
SciML:masterfrom
andreasnoack:fix-dotted-interpolation-in-rates
Sep 23, 2026
Merged

TorkelE merged 1 commit into
SciML:masterfrom
andreasnoack:fix-dotted-interpolation-in-rates

Conversation

@andreasnoack

Copy link
Copy Markdown
Contributor

Fixes #1564.

A field access such as $(sys.p) or Base.exp is Expr(:., :sys, QuoteNode(:p)). The recursive expression walkers in the DSL (recursive_escape_functions!, add_syms_from_expr!) are dispatched on ExprValues, which did not include QuoteNode, so recursing into the field position raised a MethodError. Substrates and products were unaffected because they take a different path.

This adds QuoteNode to ExprValues. The walkers already return non-Expr values unchanged, so no other change is needed. Besides the interpolation case from the issue, this also fixes module-qualified function calls in rates (k * Base.exp(-A), A --> 0), which carried the same QuoteNode.

The added test covers both, with --> and => arrows for the interpolated case. The three DSL test files pass locally against master (dsl_basic_model_construction.jl 892, dsl_advanced_model_construction.jl 81, dsl_options.jl 317 + 1 pre-existing broken); the new block fails with the reported MethodError without the fix.

🤖 Generated with Claude Code

A field access such as `$(sys.p)` or `Base.exp` is
`Expr(:., :sys, QuoteNode(:p))`. The recursive expression walkers in the
DSL (`recursive_escape_functions!`, `add_syms_from_expr!`) are dispatched
on `ExprValues`, which did not include `QuoteNode`, so recursing into the
field position raised a `MethodError`. Substrates and products were
unaffected because they take a different path.

Add `QuoteNode` to `ExprValues`. The walkers already return non-`Expr`
values unchanged, so no other change is needed.

Fixes SciML#1564.
@isaacsas

Copy link
Copy Markdown
Member

Thanks!

@TorkelE
TorkelE merged commit f1c28ed into SciML:master Sep 23, 2026
23 of 24 checks passed
@andreasnoack
andreasnoack deleted the fix-dotted-interpolation-in-rates branch September 24, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DSL: interpolating a namespaced parameter into a rate fails with MethodError on QuoteNode

3 participants