SwensenSoftware / unquote

Write F# unit test assertions as quoted expressions, get step-by-step failure messages for free
http://www.swensensoftware.com/unquote
Apache License 2.0
287 stars 25 forks source link

Make smarter choices about decompilation of AndOr and OrElse expressions which can't be differentiated #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Quotations involving && or || operators are captured as IfThenElse expressions. 
DerivedPatterns includes two patterns, AndAlso and OrElse which attempt to 
reverse engineer this form. But there are occasions when it doesn't get it 
right and specifically when a given expression matches both patterns.  For 
example

  1. false || false and false && true
  2. true || false and true && true

But we can make smarter decompilation choices based on short-circuiting 
knowledge. 

In the first case, we know "false || false" would be a better choice since 
"<expr> && true" is equivalent to just "<expr>" so "<expr> && true" with the 
literal "true" on the right hand side is an unlikely actual expression.

Similarly, in the second case, we know "true && true" is a better choice than 
"true || false".

Original issue reported on code.google.com by stephen....@gmail.com on 4 Jul 2011 at 2:09

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 4 Jul 2011 at 2:15

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 7 Jul 2011 at 3:38