The following compiles without issues:
contract C {
function f() {
int a = a;
}
}
Since variables are pre initialised to 0, the above should be effectively a no-op. I do think however it can be confusing. I would suggest throwing an error in this case or at a bare minimum a warning.
Think about:
int aa = 5;
int a = 4 * a; // user intended to use aa
The same applies to var, though that is already rejected (for a different reason):
2988.sol:3:13: Error: Declaration referenced before type could be determined.
var a = a;
^
The following compiles without issues:
Since variables are pre initialised to 0, the above should be effectively a no-op. I do think however it can be confusing. I would suggest throwing an error in this case or at a bare minimum a warning.
Think about:
The same applies to
var, though that is already rejected (for a different reason):