expressions: Fix coercion of numbers to booleans at top level.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 25 Sep 2012 22:14:50 +0000 (15:14 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 25 Sep 2012 22:14:50 +0000 (15:14 -0700)
commit0db42c2d683822e1252f17c2c81252a79e618d9c
treecc8aa6d258bd8c8fc2381f57ee2977d6bbe1079b
parent705c387fce174567cf17d01bf00625de103496d0
expressions: Fix coercion of numbers to booleans at top level.

The check for the expected type in type_check() used the wrong
constant (a node type instead of an expression type) and so the
"if" test was never true.  Also, OP_NUM_TO_BOOLEAN is binary, not
unary, so fixing just the test caused an assertion failure.

This commit fixes both problems and adds a test.

Found by GCC 4.7 report of a type mismatch.
src/language/expressions/operations.def
src/language/expressions/parse.c
tests/language/expressions/parse.at