solc-typed-ast
solc-typed-ast copied to clipboard
InferTypes crashes on unbalanced tuple assignments in 0.4.x
In 0.4.x apparently its possible to do a tuple assignment where the LHS has one fewer components than the RHS. E.g.
contract Foo {
function main() public returns (uint, uint) {
uint a;
uint c;
uint d;
(,c,d) = (1,2);
return (c,d);
}
}
Running this code returns (1,2) so it seems that the compiler is ignoring the first unnamed tuple component. There is an error if the component is named (e.g. (a,c,d)) or on any compiler after 0.5.0. Since this kinda looks like a very old compiler bug, its a rare behavior (seen 3 times over 75K contracts) might not even fix this crash. Just marking it so we don't loose track.