Fix #8450. Prevented internal compiler errors when assigning nested tuples.

This commit is contained in:
a3d4
2020-03-31 03:25:26 +02:00
parent 1897138916
commit c002cae691
5 changed files with 45 additions and 2 deletions
@@ -0,0 +1,24 @@
contract test {
function f0() public returns(int, bool) {
int a;
bool b;
((a, b)) = (2, true);
return (a, b);
}
function f1() public returns(int) {
int a;
(((a, ), )) = ((1, 2) ,3);
return a;
}
function f2() public returns(int) {
int a;
(((, a),)) = ((1, 2), 3);
return a;
}
}
// ====
// compileViaYul: also
// ----
// f0() -> 2, true
// f1() -> 1
// f2() -> 2
@@ -0,0 +1,12 @@
contract C {
function f() {
(((((((((((,2),)),)),),))=4)));
}
}
// ----
// SyntaxError: (15-69): No visibility specified. Did you intend to add "public"?
// TypeError: (46-47): Expression has to be an lvalue.
// TypeError: (60-61): Type int_const 4 is not implicitly convertible to expected type tuple(tuple(tuple(tuple(tuple(,int_const 2),),),),).
// TypeError: (37-61): Tuple component cannot be empty.
// TypeError: (36-62): Tuple component cannot be empty.
// TypeError: (35-63): Tuple component cannot be empty.
@@ -0,0 +1,6 @@
contract C {
function f() public pure {
int a;
(((a,),)) = ((1,2),3);
}
}