itemisCREATE / solidity-ide

Solidity plugin for Eclipse
Eclipse Public License 1.0
87 stars 25 forks source link

[Language] tuple types #230

Closed flantony closed 5 years ago

flantony commented 5 years ago

Currently tuple type variables with named values are not supported

pragma solidity ^0.5.1;

contract C {
    uint[] data;

    function f() public pure returns (uint, bool, uint) {
        return (7, true, 2);
    }

    function g() public {
        // Variables declared with type and assigned from the returned tuple,
        // not all elements have to be specified (but the number must match).
        (uint x, , uint y) = f();
        // Common trick to swap values -- does not work for non-value storage types.
        (x, y) = (y, x);
        // Components can be left out (also for variable declarations).
        (data.length, , ) = f(); // Sets the length to 7
    }
}
flantony commented 5 years ago

We need this to change the return types of call, delegatecall and staticcall to a tuple:

(bool success, bytes memory returnData) = address(nameReg).call(payload);

andreasmuelder commented 5 years ago

fixed with https://github.com/Yakindu/solidity-ide/pull/250