Tritlo / PropR

Genetic program repair using GHC
MIT License
30 stars 2 forks source link

Operator precedence is not respected in expr fit canditates #93

Closed Tritlo closed 3 years ago

Tritlo commented 3 years ago
     Precedence parsing error
         cannot mix ‘==’ [infix 4] and ‘==’ [infix 4] in the same infix expression
     |
 909 |                       = numRows rs == 9 `discard` lenRows rs == [9 | n <- [1 .. 9]]
     |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Tritlo commented 3 years ago

This currently works by recovery, but we should still take care to not generate such fits. The issue here is that we're replacing a && with discard, which has a different precedence! So it's not really a valid hole fit, because the precedence is different. We should check for this instead of having to recover from it.

Tritlo commented 3 years ago

It's hard for us to check this: precedence isn't checked until during renaming, so we can't tell during typechecking whether it will work until we load... and after we load it's already failed. I think the hammer will have to do for now.