Skip to content

Conversation

@molikto
Copy link
Contributor

@molikto molikto commented Jan 19, 2026

Objective

Fix #22586

The problem is in #22452 I used variant_index to compare two enum values. Because I want to maintain:

  • if you have a,b: A and tries call a.reflect_partial_cmp(b), the result should align with the version derived on A.

But appearently for dynamic types and also a: A; b: B different types, the behaviour is a bit chaotic. (see #22586)

Solution

Don't compare by variant_index anymore. It's a different tradeoff, but I think it's a more sensible one.

Testing

Modified unit tests

@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior A-Reflection Runtime information about types D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 19, 2026
@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Reflection Runtime information about types C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reflect_partial_cmp is not transitive and disagrees with reflect_partial_eq

3 participants