Disallowing shifts by signed types

This commit is contained in:
Djordje Mijovic
2020-05-26 10:18:21 +02:00
parent 69a028b49c
commit 4c3e78d046
23 changed files with 141 additions and 174 deletions
@@ -0,0 +1,11 @@
contract C {
function f(int256 a, int256 b) public returns (int256) {
return a >> b;
}
function g(int256 a, int256 b) public returns (int256) {
return a >> (256 - b);
}
}
// ----
// TypeError: (89-95): Operator >> not compatible with types int256 and int256
// TypeError: (179-193): Operator >> not compatible with types int256 and int256