mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9958 from a3d4/fix-ice-storage-parameters-in-libraries
Fix ICE caused by storage parameters with nested mappings in libraries
This commit is contained in:
commit
b5a08f8641
@ -1,5 +1,14 @@
|
||||
### 0.7.4 (unreleased)
|
||||
|
||||
Important Bugfixes:
|
||||
|
||||
|
||||
Compiler Features:
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* Type Checker: Fix internal compiler error caused by storage parameters with nested mappings in libraries.
|
||||
|
||||
|
||||
### 0.7.3 (2020-10-07)
|
||||
|
||||
|
@ -599,8 +599,13 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
||||
if (auto referenceType = dynamic_cast<ReferenceType const*>(varType))
|
||||
{
|
||||
auto result = referenceType->validForLocation(referenceType->location());
|
||||
if (result && (_variable.isConstructorParameter() || _variable.isPublicCallableParameter()))
|
||||
result = referenceType->validForLocation(DataLocation::CallData);
|
||||
if (result)
|
||||
{
|
||||
bool isLibraryStorageParameter = (_variable.isLibraryFunctionParameter() && referenceType->location() == DataLocation::Storage);
|
||||
bool callDataCheckRequired = ((_variable.isConstructorParameter() || _variable.isPublicCallableParameter()) && !isLibraryStorageParameter);
|
||||
if (callDataCheckRequired)
|
||||
result = referenceType->validForLocation(DataLocation::CallData);
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
solAssert(!result.message().empty(), "Expected detailed error message");
|
||||
|
@ -0,0 +1,6 @@
|
||||
struct S { mapping(uint => uint)[2] a; }
|
||||
contract C {
|
||||
function f(S storage s) public {}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6651: (69-80): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given.
|
@ -0,0 +1,4 @@
|
||||
struct S { mapping(uint => uint)[2] a; }
|
||||
library L {
|
||||
function f(S storage s) public {}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
library Test {
|
||||
struct Nested { mapping(uint => uint)[2][] a; }
|
||||
struct X { Nested n; }
|
||||
function f(X storage x) public {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user