mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9702 from a3d4/fix-7410-arrays-of-mappings
Fix ICE caused by an array of mappings
This commit is contained in:
commit
3af21c92d2
@ -7,6 +7,10 @@ Compiler Features:
|
|||||||
* General: Option to stop compilation after parsing stage. Can be used with ``solc --stop-after parsing``
|
* General: Option to stop compilation after parsing stage. Can be used with ``solc --stop-after parsing``
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Type Checker: Fix internal compiler error when calling `.push(<arg>)` for a storage array with a nested mapping.
|
||||||
|
|
||||||
|
|
||||||
### 0.7.2 (2020-09-28)
|
### 0.7.2 (2020-09-28)
|
||||||
|
|
||||||
Important Bugfixes:
|
Important Bugfixes:
|
||||||
|
@ -2684,10 +2684,20 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
|||||||
"Using \"." + memberName + "(...)\" is deprecated. Use \"{" + memberName + ": ...}\" instead."
|
"Using \"." + memberName + "(...)\" is deprecated. Use \"{" + memberName + ": ...}\" instead."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
funType->kind() == FunctionType::Kind::ArrayPush &&
|
||||||
|
arguments.value().numArguments() != 0 &&
|
||||||
|
exprType->containsNestedMapping()
|
||||||
|
)
|
||||||
|
m_errorReporter.typeError(
|
||||||
|
8871_error,
|
||||||
|
_memberAccess.location(),
|
||||||
|
"Storage arrays with nested mappings do not support .push(<arg>)."
|
||||||
|
);
|
||||||
|
|
||||||
if (!funType->bound())
|
if (!funType->bound())
|
||||||
if (auto contractType = dynamic_cast<ContractType const*>(exprType))
|
if (auto contractType = dynamic_cast<ContractType const*>(exprType))
|
||||||
requiredLookup = contractType->isSuper() ? VirtualLookup::Super : VirtualLookup::Virtual;
|
requiredLookup = contractType->isSuper() ? VirtualLookup::Super : VirtualLookup::Virtual;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
annotation.requiredLookup = requiredLookup;
|
annotation.requiredLookup = requiredLookup;
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
contract C {
|
||||||
|
mapping(uint=>uint)[] array;
|
||||||
|
mapping(uint=>uint) map;
|
||||||
|
function f() public {
|
||||||
|
array.pop();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
contract C {
|
||||||
|
mapping(uint=>uint)[] array;
|
||||||
|
mapping(uint=>uint) map;
|
||||||
|
function f() public {
|
||||||
|
array.push();
|
||||||
|
array.push(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 8871: (131-141): Storage arrays with nested mappings do not support .push(<arg>).
|
Loading…
Reference in New Issue
Block a user