-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResultBuilder::reconstructExpression() checks for impossible value: "!" #617
Comments
…ue `!`, so don't check for it.
Good catch, @RossBencina. Sorry it's taken a while to get to this (and thanks, @horenmar, for surfacing it in your review). You are quite correct that the condition is never met. The idea here is that if you write an expression, like:
or:
instead. As I say, somewhere along the way that detection has gone missing. It's not behaviour-breaking so it looks like that got missed at the time. Maybe it's not a big deal. Perhaps it's not worth warning about this. What do you guys think? If it's not worth warning about then let's go with Ross' PR (or something similar - I haven't checked it but I'm sure it's fine). If we want to restore the original behaviour I'll take a look at where that needs to be added back in (shouldn't be a big job). |
@philsquared If the code really is |
@RossBencina I think it was meant for objects that have overloaded conversion to bool, so that if you have an object that can be truthy or falsy, then for testing whether its falsy As to whether the warning is needed, I am not sure. I think it will be obvious to user when the decomposition fails, but it might not be so obvious that the proper fix is to use I think it would be worthwhile to make it work again, as long as the amount of work is not excessive. |
This (and the related PR) can be closed as the "impossible value" check has been knowingly removed as part of the lazy-reconstruction patch. |
The following comparison is present in
ResultBuilder::reconstructExpression()
:catch_result_builder.hpp: 147
However, as far as I can tell,
m_exprComponents.op
can never be equal to"!"
.m_exprComponents.op
is constructed as an empty string, and after that is only set via calls toResultBuilder::setOp
. There are two calls tosetOp
:Here are the possible return values for
OperatorTraits<Op>::getName()
:Proposed Fix
(Available as PR: #618)
Remove the check and delete the default branch, which can never be reached:
The text was updated successfully, but these errors were encountered: