mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow arrays of contract types as type expressions e.g. for abi.decode.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() view public {
|
||||
C[0];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6133: (52-56): Statement has no effect.
|
||||
// Warning 2018: (17-63): Function state mutability can be restricted to pure
|
||||
@@ -1,7 +0,0 @@
|
||||
contract C {
|
||||
function f() view public {
|
||||
C[0];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2876: (52-56): Index access for contracts or libraries is not possible.
|
||||
@@ -4,4 +4,4 @@ library C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2876: (51-55): Index access for contracts or libraries is not possible.
|
||||
// TypeError 2876: (51-55): Index access for library types and arrays of libraries are not possible.
|
||||
|
||||
@@ -3,4 +3,3 @@ contract s{}
|
||||
function f() {s[:][];}
|
||||
// ----
|
||||
// TypeError 1760: (53-57): Types cannot be sliced.
|
||||
// TypeError 2876: (53-59): Index access for contracts or libraries is not possible.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function f(bytes calldata x) public pure returns (C[] memory c) {
|
||||
c = abi.decode(x, (C[]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user