You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> ExampleContract.sol
Error: Different number of components on the left hand side (2) than on the right hand side (1).
--> ExampleContract.sol:12:9:
|
12 | (address a, address[] memory b) = this.foo();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Type uint256 is not implicitly convertible to expected type address.
--> ExampleContract.sol:12:9:
|
12 | (address a, address[] memory b) = this.foo();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The text was updated successfully, but these errors were encountered:
@m1cm1c this is intended behavior, as pointed out in https://docs.soliditylang.org/en/v0.8.2/contracts.html#getter-functions.
The array itself cannot be returned in its entirety, to avoid unbounded gas costs. If the array is not inside a struct, its getter is a function that takes the index as an argument. When the array is inside a struct, there's no simple way to give the index to the struct's getter, similar to the mapping inside struct example in the link above.
Description
Arrays are ignored from structs in automatically generated getters.
Environment
Steps to Reproduce
Write the following code into a file named
ExampleContract.sol
:Run:
solc ExampleContract.sol
The output will be:
The text was updated successfully, but these errors were encountered: