ASC should infer the "(v + 1)" to be a float value and therefore shouldn't have a problem with "float > float". var v:float = 0; var f:* = (v + 1) > 0; var g:* = (v + 1) > v; [Compiler] Error #1176: Comparison between a value with static type Number and a possibly unrelated type float. as3/Types/Float/test.as, Ln 12, Col 14: var g:* = (v + 1) > v; .............^
Looks like evaluate(Context,BinaryExpressionNode) does not pass type information up the expression tree for non-constant expressions, and maybe not even then? Looks pretty much broken...
The type information for the constant Number node is not updated with the information that it is float, when that is discovered.
Looks straightforward to fix for binary expressions but might also be broken for unary expressions; hard to know for sure but we fixed a bug around typeof for UnaryExpression that seemed similar. (No test case was created.) We need a number of test cases here to ferret out bugs.
changeset: 82:e28357651be7 user: Lars T Hansen <firstname.lastname@example.org> date: Thu Dec 08 09:41:32 2011 +0100 summary: Fix 708300 - [ASC BUG] ASC strict mode error comparing (float + int) > float
Some test cases landed with that changeset.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
testmedia: test/acceptance/as3/asc/compare-with-inference.as changeset: 7050:237162347a88 parent: 7048:2e3b3a868c0a user: Lars T Hansen <email@example.com> date: Thu Dec 08 10:36:55 2011 +0100 summary: Fix 708300 - [ASC BUG] ASC strict mode error comparing (float + int) > float, update asc.jar to asc-float 83:b67b2caffa58
Status: RESOLVED → VERIFIED
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.