Better error messages on invalid operators
commitfb6b9258803dd6ad406d29c53be939673317f296
authorThomas Jiang <thomasjiang@fb.com>
Fri, 7 May 2021 05:35:59 +0000 (6 22:35 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 7 May 2021 05:37:21 +0000 (6 22:37 -0700)
tree0095c3b2dd40d4bdb9d3d8aeaa3568d4f5784a48
parent1fe56fb03734698b901fa0021b8feef887e6540d
Better error messages on invalid operators

Summary:
Previously the error message read:
```
Expression trees only support comparison (`<`, `===` etc) and basic arithmetic operators (`+` etc)
```

Change the error to be more specific about what operator we don't support. For some operators, I suggest a possible solution, but since the design of expression trees is so flexible, I do not recommend solutions in other cases.

User reports that:
> Can we improve this error?  It took me a minute to realize that != isn't supported comparison.

Reviewed By: Wilfred

Differential Revision: D28207743

fbshipit-source-id: 541eb8fed3a730160f7e7576d7426e96a3254545
hphp/hack/src/parser/lowerer/desugar_expression_tree.rs
hphp/hack/test/typecheck/expression_trees/invalid_operator.php.exp
hphp/hack/test/typecheck/expression_trees/invalid_operator.php.like_types.exp