mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix ICE caused by storage parameters with nested mappings in libraries
This commit is contained in:
parent
93df3d43df
commit
d7b4b4a7aa
@ -1,5 +1,14 @@
|
|||||||
### 0.7.4 (unreleased)
|
### 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)
|
### 0.7.3 (2020-10-07)
|
||||||
|
|
||||||
|
@ -599,8 +599,13 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
|||||||
if (auto referenceType = dynamic_cast<ReferenceType const*>(varType))
|
if (auto referenceType = dynamic_cast<ReferenceType const*>(varType))
|
||||||
{
|
{
|
||||||
auto result = referenceType->validForLocation(referenceType->location());
|
auto result = referenceType->validForLocation(referenceType->location());
|
||||||
if (result && (_variable.isConstructorParameter() || _variable.isPublicCallableParameter()))
|
if (result)
|
||||||
result = referenceType->validForLocation(DataLocation::CallData);
|
{
|
||||||
|
bool isLibraryStorageParameter = (_variable.isLibraryFunctionParameter() && referenceType->location() == DataLocation::Storage);
|
||||||
|
bool callDataCheckRequired = ((_variable.isConstructorParameter() || _variable.isPublicCallableParameter()) && !isLibraryStorageParameter);
|
||||||
|
if (callDataCheckRequired)
|
||||||
|
result = referenceType->validForLocation(DataLocation::CallData);
|
||||||
|
}
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
solAssert(!result.message().empty(), "Expected detailed error message");
|
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