Skip to content

Fix MultiValueDomain reductions#2541

Merged
OliverGerstl merged 4 commits into
mainfrom
2540-reductions-accessed-before-set
Jun 12, 2026
Merged

Fix MultiValueDomain reductions#2541
OliverGerstl merged 4 commits into
mainfrom
2540-reductions-accessed-before-set

Conversation

@MaxAtoms

@MaxAtoms MaxAtoms commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Lift the default reductions processing from the MultiValueDomain to the PartialProductDomain.

@OliverGerstl Feel free to give feedback or edit the PR yourself as you see fit :)
Not sure whether we want to keep the new test cases and their structure, because they deviate from the domain tests we currently have.

The fact that we have two ways to define reductions (via either the constructor parameter or overriding the reduce function) adds complexity, but I see why we would want to have both.

Closes #2540

Disclaimer: Identified and fixed using OpenCode and Claude Opus 4.8, with some manual minor clean-up by hand

MaxAtoms added 2 commits June 9, 2026 12:57
PartialProductDomain's constructor invokes the overridable reduce() before subclasses initialize their fields. MultiValueDomain.reduce read this.reductions, which was still undefined at that point, so every construction threw a TypeError - making MultiValueDomain and MultiValueStateDomain unusable, including their reductions feature.

Lift the reductions into PartialProductDomain so the field is set before reduce is called, preserving the reduce-after-clone semantics. Add regression tests.
@MaxAtoms MaxAtoms requested a review from OliverGerstl June 9, 2026 11:23
@MaxAtoms MaxAtoms self-assigned this Jun 9, 2026

@OliverGerstl OliverGerstl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for identifying and fixing the issue.
The solution is fine for me, but I am also not so happy about the generated tests.
I think we don't need them for now, as we will probably have more meaningful tests as soon as the multi-value domain is actually used :)

@OliverGerstl OliverGerstl merged commit f459b19 into main Jun 12, 2026
19 checks passed
@OliverGerstl OliverGerstl deleted the 2540-reductions-accessed-before-set branch June 12, 2026 16:56
@EagleoutIce

Copy link
Copy Markdown
Member

This pull request is included in v2.10.8 (see Release v2.10.8 (MultiValue fixes, refined input sources, fixed linter rules)).

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.

[Bug]: Internal bug in MultiValueDomain - Reductions accessed before being set

3 participants