mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow inline arrays of mapping type.
This commit is contained in:
parent
124a8def84
commit
c445e7dfa4
@ -23,6 +23,7 @@ Bugfixes:
|
|||||||
* Type Checker: Disallow struct return types for getters of public state variables unless the new ABI encoder is active.
|
* Type Checker: Disallow struct return types for getters of public state variables unless the new ABI encoder is active.
|
||||||
* Type Checker: Fix internal compiler error when a field of a struct used as a parameter in a function type has a non-existent type.
|
* Type Checker: Fix internal compiler error when a field of a struct used as a parameter in a function type has a non-existent type.
|
||||||
* Type Checker: Disallow functions ``sha3`` and ``suicide`` also without a function call.
|
* Type Checker: Disallow functions ``sha3`` and ``suicide`` also without a function call.
|
||||||
|
* Type Checker: Disallow inline arrays of mapping type.
|
||||||
|
|
||||||
Build System:
|
Build System:
|
||||||
* Emscripten: Upgrade to Emscripten SDK 1.37.21 and boost 1.67.
|
* Emscripten: Upgrade to Emscripten SDK 1.37.21 and boost 1.67.
|
||||||
|
@ -1608,6 +1608,9 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
|
|||||||
{
|
{
|
||||||
if (!inlineArrayType)
|
if (!inlineArrayType)
|
||||||
m_errorReporter.fatalTypeError(_tuple.location(), "Unable to deduce common type for array elements.");
|
m_errorReporter.fatalTypeError(_tuple.location(), "Unable to deduce common type for array elements.");
|
||||||
|
else if (!inlineArrayType->canLiveOutsideStorage())
|
||||||
|
m_errorReporter.fatalTypeError(_tuple.location(), "Type " + inlineArrayType->toString() + " is only valid in storage.");
|
||||||
|
|
||||||
_tuple.annotation().type = make_shared<ArrayType>(DataLocation::Memory, inlineArrayType, types.size());
|
_tuple.annotation().type = make_shared<ArrayType>(DataLocation::Memory, inlineArrayType, types.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
contract C {
|
||||||
|
mapping(int => int) a;
|
||||||
|
function f() public {
|
||||||
|
[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError: (66-69): Type mapping(int256 => int256) is only valid in storage.
|
Loading…
Reference in New Issue
Block a user