Merge pull request #6080 from ethereum/library-index-access

Disallow index access on contracts and libraries
This commit is contained in:
chriseth
2019-02-26 13:26:05 +01:00
committed by GitHub
5 changed files with 28 additions and 0 deletions
@@ -0,0 +1,11 @@
contract C {
C[] y = new C[](3);
C[3] x;
function f() public {
C[3] memory z;
y.push(this);
x[0] = this;
z[0] = this;
}
}
@@ -0,0 +1,7 @@
contract C {
function f() view public {
C[0];
}
}
// ----
// TypeError: (52-56): Index access for contracts or libraries is not possible.
@@ -0,0 +1,7 @@
library C {
function f() view public {
C[0];
}
}
// ----
// TypeError: (51-55): Index access for contracts or libraries is not possible.