Menu

#5 antic priority checking should use type info

open
nobody
None
5
2004-11-04
2004-11-04
No

antic version 1.11.1 will warn "May be wrong assumption about
operators priorities" when in fact any wrong assumption would
include assuming that the type system were broken. What's more,
the way in which it does so isn't entirely consistent.

Example code:

public void falsePriorityWarning(int row, int col)
{
boolean a = (row == 0) ^ col == 0;
return (row == 0) ^ col == 0;
}

With "antic -java" this gives a warning about the line which assigns
to a. It doesn't warn about the second line, despite the expression
being identical. Moreover, since we've specified that it's Java code,
the author cannot intend the expression to be equivalent to

boolean a = ((row == 0) ^ col) == 0;

because (boolean ^ int) won't type.

Discussion


Log in to post a comment.