mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix ICE on invalid tuple assignments.
This commit is contained in:
parent
bb1a8df97e
commit
9a429e2300
@ -10,6 +10,7 @@ Compiler Features:
|
|||||||
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
* Type Checker: Fix internal compiler error on tuple assignments with invalid left-hand side.
|
||||||
|
|
||||||
|
|
||||||
### 0.8.16 (2022-08-08)
|
### 0.8.16 (2022-08-08)
|
||||||
|
@ -166,8 +166,15 @@ void TypeChecker::checkDoubleStorageAssignment(Assignment const& _assignment)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TupleExpression const* lhsTupleExpression = dynamic_cast<TupleExpression const*>(&_assignment.leftHandSide());
|
||||||
|
if (!lhsTupleExpression)
|
||||||
|
{
|
||||||
|
solAssert(m_errorReporter.hasErrors());
|
||||||
|
return;
|
||||||
|
}
|
||||||
count(
|
count(
|
||||||
dynamic_cast<TupleExpression const&>(_assignment.leftHandSide()),
|
*lhsTupleExpression,
|
||||||
dynamic_cast<TupleType const&>(*type(_assignment.rightHandSide())),
|
dynamic_cast<TupleType const&>(*type(_assignment.rightHandSide())),
|
||||||
count
|
count
|
||||||
);
|
);
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
contract C {
|
||||||
|
function f() internal pure {}
|
||||||
|
function g() internal pure returns (uint256) {}
|
||||||
|
function h() internal pure returns (uint256, uint256) {}
|
||||||
|
function test() public pure {
|
||||||
|
f() = ();
|
||||||
|
g() = (uint256(1));
|
||||||
|
h() = (uint256(1), uint256(2));
|
||||||
|
h() = ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 4247: (184-187): Expression has to be an lvalue.
|
||||||
|
// TypeError 4247: (196-199): Expression has to be an lvalue.
|
||||||
|
// TypeError 4247: (218-221): Expression has to be an lvalue.
|
||||||
|
// TypeError 4247: (252-255): Expression has to be an lvalue.
|
||||||
|
// TypeError 7407: (258-260): Type tuple() is not implicitly convertible to expected type tuple(uint256,uint256).
|
Loading…
Reference in New Issue
Block a user