Skip to content

Conversation

@jnyrup
Copy link
Member

@jnyrup jnyrup commented Oct 20, 2021

My analysis in #1712 was not spot on.

Lifted operators are fine to use in Expressions, but only as long as we keep the LHS and RHS lifted.
The compiler converts e => e.Number > 43 into e => e.Number > Convert(43), which is the expression form of e => e.Number > (int?)43.
So the problem was that we tried to reduce (int?)43 to 43, which is not allowed.

This also add a check to avoid reducing already constant expressions.

This fixes #1712

@jnyrup jnyrup merged commit 9e83a44 into fluentassertions:master Oct 20, 2021
@jnyrup jnyrup deleted the PR1712 branch October 20, 2021 07:59
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.

ConstantSubExpressionReductionVisitor throws on lifted operator

2 participants