-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix segmentation fault when assigning to a parenthesized non-tuple ex…
…pression of a tuple type Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...xTests/tupleAssignments/assignments_to_tuple_and_non_tuple_expressions_of_tuple_types.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
contract C { | ||
uint[] public array; | ||
|
||
function f() public { | ||
// (f()) is not a tuple expression, but its value is a tuple. | ||
(f()) = (); | ||
} | ||
|
||
function g() public { | ||
// (revert()) is not a tuple expression, but its value is a tuple. | ||
(revert()) = (); | ||
} | ||
|
||
function h() internal returns (uint, uint) {} | ||
|
||
function i() public { | ||
// (h()) is not a tuple expression, but its value is a tuple (uint, uint). | ||
(h()) = (1, 1); | ||
} | ||
|
||
function j() public returns (uint, uint) { | ||
// (j()) is not a tuple expression, but its value is a tuple (uint, uint). | ||
(j()) = (1, 1); | ||
} | ||
|
||
function m() public { | ||
// (uint x, uint y) is a tuple expression, and its value is a tuple (uint, uint). | ||
(uint x, uint y) = (1, 1); | ||
} | ||
|
||
function n() public { | ||
// ((array.push(), array.push())) is a tuple expression of a tuple expression, and its value is a tuple (pointer uint, pointer uint). | ||
((array.push(), array.push())) = (1, 1); | ||
} | ||
} | ||
// ---- | ||
// TypeError 4247: (126-129): Expression has to be an lvalue. | ||
// TypeError 4247: (236-244): Expression has to be an lvalue. | ||
// TypeError 4247: (407-410): Expression has to be an lvalue. | ||
// TypeError 4247: (550-553): Expression has to be an lvalue. |